I have 3 tables in DB, m..m relation
id2, x, y ..
I'm inserting new rows to table1 using a form, and the P. key field is set to AUTO_INCR, because there's no other property that can be meaningful enough to distinguish between the records..
so I want to be able to insert a new row to table1 and after that insert a new row to table3, while table3.id1 is the table1.id1 that I just added. but here I'm stuck since I have no idea what value was set to the table1.id1! I'm thinking of checking for the max(table1.id1) after the first query is executed..is there a better way to find out what was the value inserted?
here's my code:
$query = "INSERT INTO tbl1 (Id1, a, b, c) VALUE(NULL, '$a', '$b', '$c');"; $query2 = "INSERT INTO tbl3 (Id1, Id2) VALUES ('[B]??[/B]', '$x');";