#1216 - Cannot add or update a child row
Posted: Wed Jul 20, 2005 4:29 am
Hi guys.
I have a mySQL database that I am using through phpmyadmin. It has about 13 tables in it. Most of the tables have a field called "username" which I have made a foreign key (linked to the key field in my username table). This works fine when I set it, however now I am trying to edit a username in the username table (the username is the key field in the username table) and have it update the other tables where it is present. But I get the following error message... "#1216 - Cannot add or update a child row: a foreign key constraint fails".
Any ideas how I can fix my problem?
Thanks
Craig
I have a mySQL database that I am using through phpmyadmin. It has about 13 tables in it. Most of the tables have a field called "username" which I have made a foreign key (linked to the key field in my username table). This works fine when I set it, however now I am trying to edit a username in the username table (the username is the key field in the username table) and have it update the other tables where it is present. But I get the following error message... "#1216 - Cannot add or update a child row: a foreign key constraint fails".
Any ideas how I can fix my problem?
Thanks
Craig