MySQL Forums
Forum List  »  InnoDB

Re: ERROR: Error 1452: Cannot add or update a child row: a foreign key constraint fails
Posted by: Chad Bourque
Date: April 19, 2010 12:35PM

Lee-Ann,

You have to use an existing web-cv value in the venue table. You are trying to insert a value of 0 (which apparently doesn't exist). When you insert a value of zero into an auto_increment column, it takes the next number. So, if you do a:

select * from web_cv;

You'll likely see web_cv_id values of 1, 2, & 3 rather than 0 (though they may be other values than the ones I listed). At any rate, you'll need one of those values for your insert in the venue table. The constraint is preventing you from adding a child row (venue) that doesn't have a parent row associated with it (web_cv).

HTH,
Chad

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: ERROR: Error 1452: Cannot add or update a child row: a foreign key constraint fails
3950
April 19, 2010 12:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.