Insert foreign key failed
Please can anyone help me please,
I have 3 tables: course(idc, title), participant(idp,username) and registered. the table registered contain (#idc, #idp, date) in MySQL
I want to insert in the table registered a participant in a course.
I do that:
INSERT INTO 'registered' (idc, idp, date) VALUES (
(SELECT idc FROM course WHERE title='${title}';),
(SELECT idp FROM 'participant' WHERE 'username'='${login}';),
CURRENT_DATE);
but it doesn't work!
thanks for help!
Asma
Comments
hi sean,
i don't undrestand what you mean.
my objective is to insert in the table registred a new line of a particpant (idp) on a course (idc).
in this requete the value of the idc is the select of th title of the course where the title is entred in the forum.
and the same logic for the idp.
i found the folowing post that help me
http://dba.stackexchange.com/questions/46410/how-do-i-insert-a-row-which...
but any thing happen in the DB.