954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Cannot insert 2 foreign key in the same time

hii all,
i've create upload website,
i've been stuck with following error
i had 3 tables in my database
table request, table upload and table feedback
table request :
id_request;---primary key
subjek;
isi;
pelaksana;

table upload :
id_upload,----primary key
id_request,----foreign key
filename,
filedata,
filesize,
filetype

table feedback :
id_feedback,----primary key
id_request,----foreign key
feedback,

id_request in table request is auto_increment
then i want to insert it to table upload and table feedback the id_request as foreign key in the same time
how to insert that?
because i was use last insert id it doesn't work
i'm using each queries to insert that

the queries looking like this :

$fk = mysql_query("insert into feedback (id_request) select id_request from request where id_request = LAST_INSERT_ID()");
$foreign = mysql_query("insert into uploads (id_request) select id_request from request where id_request = LAST_INSERT_ID()");

sungkono
Newbie Poster
2 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: