Foreign keys

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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!

Re: Foreign keys

On Thu, 05 Jul 2007 13:19:18 +0200, Giulio Simeone  

Quoted text here. Click to load it

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

Site Timeline