return an id field to php after SQL INSERT command?
Hi guys,
I was wondering if it is possible to return the id field of a record which has just been inserted using the SQL INSERT command? At the moment I have to then run another query to get the id field of the record I have just inserted.
Basically I have two tables
1.customers
2.address_book
I want to INSERT INTO customers all the customers details....
then I want to INSERT INTO address_book the customers address and the customers_id field which is the foriegn key.
At the moment I have to run another query on the customers table to get the customers_id for the record I have just inserted.
Is there a way SQL could return this info to me without having to do another query?
thanks,
grandmasterC
:confused: