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
#1216 - Cannot add or update a child row
Moderator: General Moderators
All i am trying to do is rename the Username which is the primary key in my user table. This is also present in other tables. for example....
Users Table
Username (PK)
other unrealted fields
Upload Table
(other fields)
Username (FK)
So when the username in the users table is changed it automatically updates the upload table to reflect the changes. However the error in my first post is returned.
Users Table
Username (PK)
other unrealted fields
Upload Table
(other fields)
Username (FK)
So when the username in the users table is changed it automatically updates the upload table to reflect the changes. However the error in my first post is returned.