By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,867 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

Foreign keys

P: n/a
Hello,
when I try to insert a new record in a certain table I get the error

Cannot add or update a child row: a foreign key constraint fails

The table has three foreign keys and six other fields, but this error
appairs with every record I try to insert in the table, even if I
don't give any values to the foreign keys.

What can be the problem?

Thank you in advance!

Jul 5 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rik
On Thu, 05 Jul 2007 13:19:18 +0200, Giulio Simeone
<vi************@yahoo.itwrote:
Hello,
when I try to insert a new record in a certain table I get the error

Cannot add or update a child row: a foreign key constraint fails

The table has three foreign keys and six other fields, but this error
appairs with every record I try to insert in the table, even if I
don't give any values to the foreign keys.

What can be the problem?
This is a database question, not PHP, so ask in a database group.

That being said: in MySQL it's only possible to leave a foreign key
'empty' when using NULL, no other values allowed. So the field has to
allow NULL values, and NULL is not the same as 0 or an empty string.

--
Rik Wasmus
Jul 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.