Hi All,
I’m having trouble figuring out how to update a users table that has this value added to it
ADD CONSTRAINT `users_1` FOREIGN KEY (`userid`) REFERENCES `home` (`userid`) ON DELETE CASCADE ON UPDATE CASCADE;
I tried writing this command in phpmyadmin but get an error:
INSERT INTO userprofile
SET userid = ‘3’,
fname = ‘abc’,
lname = ‘abcd’;
and get this error:
#1452 - Cannot add or update a child row: a foreign key constraint fails (
mydb
.userprofile
, CONSTRAINTusers_1
FOREIGN KEY (userid
) REFERENCEShome
(userid
) ON DELETE CASCADE ON UPDATE CASCADE)
First off, how do I insert anything into my tables (not created by me) and how would I update it?