mysql - PHP : inserting row id to another table -


how can row id of tbl_questions , send tbl_link_qa , tbl_answers send it's row number tbl_link_qa (same tbl_questions) time must correspond first row number tbl_questions inserted first @ tbl_link_qa

i need link row number of question tbl_questions , row number of answer tbl_answers.

need bad

rec_id---qrec_id---arec_id

96------------0-----------0

95------------0-----------0

i need make >>

rec_id---qrec_id----arec_id

96----------123----------456

95----------124----------

123 , 124 row number tbl_questions inserted tbl_link_qa , 456 tbl_answers

use mysql_insert_id auto_increment id of last row inserted.

ex:

mysql_query("insert tbl_questions values (something)"); $question_id = mysql_insert_id();  mysql_query("insert tbl_answer values (something)"); $answer_id = mysql_insert_id();  mysql_query("insert tbl_link_qa (qrec_id, arec_id) values ($question_id, $answer_id)"); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -