You are here: Re: How do I find out what foreign keys depend on this roy? « PHP SQL « IT news, forums, messages
Re: How do I find out what foreign keys depend on this roy?

Posted by laredotornado on 07/25/06 16:10

Thanks but the error actually says "parent row" and not "child row".
So how do I deal with taht?

IchBin wrote:
> laredotornado@zipmail.com wrote:
> > Hi, Using PHP 4, MySQL 4, I'm getting an error when executing an SQL
> > statement:
> >
> > Statement failed "DELETE FROM USERS WHERE USER_ID = 17" - Cannot delete
> > or update a parent row: a foreign key constraint fails
> >
> > How can I query the SQL database to figure out what parent row the
> > statement is complaining about?
> >
> > Thanks,-
> >
> For those encountering the problem " ERROR 1216: Cannot add or update
> a child row: a foreign key constraint fails", it actually means what it
> says! Some row in the child does not comply with the constraint, correct
> the problem.
> You find the rows like this:
> select child.id from child left join parent on
> (child.parent_id=parent.id) where child.id is not null and parent.id is
> null;
>
> http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html
>
>
> Thanks in Advance...
> IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
> __________________________________________________________________________
>
> 'If there is one, Knowledge is the "Fountain of Youth"'
> -William E. Taylor, Regular Guy (1952-)

 

Navigation:

[Reply to this 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

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