So I’ve been trying to insert data into a table called poubelle through a web page but each time I received this error but I don’t understand why I’m getting this error thats prevents me from inserting data. Any help is welcome and thanks in advance.
Error: INSERT INTO poubelle VALUES (PID = 1, uid = 1);
Cannot add or update a child row: a foreign key constraint fails (poubelle_connecter
.poubelle
, CONSTRAINT fk_uid
FOREIGN KEY (uid
) REFERENCES enregistrer
(uid
))
The structure of table enregistrer is:
and for the table poubelle is
PID INT(11) PRIMARY KEY
uid INT(11) FOREIGN KEY REFERENCES enregistrer(uid)