HI GUYS ..

im trying to make foreign key relation between whishlist_tbl(foreign) table and account_tbl(primary key) table
both are integer data container

scenario

i have user deatail table that is account_tbl and whish list table i.e wishlist_tbl i want that when user make a wish book then he must be registerd one and he must have account id i.e ac_id in the account_tbl where any or every wish item user add in the wishlist_tbl table must have his ac_id link with account_tbl, but when i tried to make relationship between both table this error occurs

SQL message

Cannot add or update a child row: a foreign key constraint fails (birds_eye.<result 2 when explaining filename '#sql-1204_1'>, CONSTRAINT FK_wishlist_tbl FOREIGN KEY (ac_id) REFERENCES account_tbl (ac_id))

***can anyone guide me what m i doing wrong because i've no idea as i ve made other relation like the same in this data base too and they are fine btw this a cart database any sugestion would be appericiated do reply thank all
***

mysql and tool is sqlyog

i uses GUI that is SQLYOQ but the qurey pop up with error msg is:

alter tablebirds_eye.wishlist_tbladd constraintFK_wishlist_tbl_acFOREIGN KEY (ac_id) REFERENCESaccount(ac_id)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.