How To Insert PK (Primary Key) in Table1 To FK(Foreign Key) in Table2 then show it the result?

Queries you should execute in order: to begin transaction (lock the table) BEGIN //insert your customer INSERT INTO table_customer (cust_name, address, sex) VALUES ( '$name' , '$address', '$sex') //select last auto generated ID from customer table SELECT id FROM table_customer ORDER BY id DESC LIMIT 1 //fetch the id selected in last query to $cID and use it in this query INSERT INTO table_list (id, list_name, detail) VALUES ( $cID, '$listName', '$detail' ) //commit changes and end transaction COMMIT Remember this is only example, and I didn't write any php code (I accume you can do it yourself). To get it to work you will have to change bits and pieces. But the key is to LOCK and UNLOCK the table (use transaction) so no other row can be added to customers before you actually get the latest id.

Queries you should execute in order: //to begin transaction (lock the table) BEGIN //insert your customer INSERT INTO table_customer (cust_name, address, sex) VALUES ( '$name' , '$address', '$sex') //select last auto generated ID from customer table SELECT id FROM table_customer ORDER BY id DESC LIMIT 1 //fetch the id selected in last query to $cID and use it in this query INSERT INTO table_list (id, list_name, detail) VALUES ( $cID, '$listName', '$detail' ) //commit changes and end transaction COMMIT Remember this is only example, and I didn't write any php code (I accume you can do it yourself). To get it to work you will have to change bits and pieces. But the key is to LOCK and UNLOCK the table (use transaction) so no other row can be added to customers before you actually get the latest id...

Sorry i'm not read it for a few days, i'm still not understand,can you explain it more details,, – why_u Jul 25 at 7:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions