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

March 7, 2014 by PetuaTerbaik
Filed under: Uncategorized 

Dear all, did u frust when you use mysql that cannot insert foreign key? constraint fail ? or some other headache as u come from the problem Below ???

Error: 1452 SQLSTATE: 23000 (ER_NO_REFERENCED_ROW_2)

Message: Cannot add or update a child row: a foreign key constraint fails (%s)

Here the solution, why not u EMPTY the table.!! please remember EMPTY first.. not drop ok???

THat’s solve the CHILD and Parent Problem of the mysql relationship !!

PHP must check the data first, the data that u insert must in refrence with Parent !!! not SILA PILIH… it must insert a valid value from the Parent .

Incoming search terms:

  • how to solve the cannot add or update a child row (2)


Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


You might also like :

[SOLVED] Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in Warning: mysql_fetch_array()...
MYSQL Database Structure Field is Case Sensitive when you are...
Between Facebook for Nokia vs Facebook for Android vs Facebook for Iphone vs Dear...

Images hosting provided by ImageShack Via ImageShack Migration plugin

Desclaimer : This website and the Materials are provided "as is" and "as available", without warranty of any kind, implied, express or statutory. Petua Terbaik or PetuaTerbaik.kaer-media.org shall not be liable for any loss or damage caused by the usage of any information or Materials obtained from this website. We are also not hosting the material, the material we get are only link from other site. Penafian : Petua Terbaik tidak bertanggungjawab terhadap sebarang kehilangan atau kerosakan yang dialami kerana menggunakan maklumat dalam laman ini. Kami juga tidak membekalkan bahan di server kami, bahan yang kami dapat adalah pautan dari web yang lain.
This site is protected by WP-CopyRightPro