Reply to Re: Foreign keys

Your name:

Reply:


Posted by Rik on 07/05/07 14:19

On Thu, 05 Jul 2007 13:19:18 +0200, Giulio Simeone
<viandante20005@yahoo.it> wrote:

> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация