I have tables like these:
table1 (table1_id, table1_attribute1, table1_attribute2)
table2 (table2_id, table1_id*, table2_attribute1, table2_attribute2)
The primary key of the first table is table1_id. It is auto incrementing and it is also a foreign key for the other table - table2.
Let's say I want to add a new record in both tables.
To add a new record to table1 is simple. I don't have to give value to table1_id since it is auto incrementing.
The problem is with table2. Here I have to set a value for the foreign key table1_id. How can I get the auto incremented value of table1_id from table1 so I can use it in table2?
Do I make any sense?
Any help would be fantastic.