Prathaban Mookiah wrote:
I have run into a tricky situation and need some help to work my way through
the problem. I use MySQL.
I accept some data from the user and insert them into two tables.
1. I insert part of the data into the first table. I do not specify the
primary key field. It is auto generated through auto_increment. All the
other fields can have duplicates.
2. Then I want to insert the other part of the data along with the primary
key that was automatically generated during the previous insert operation
into the second table.
My problem is this: How do I retrieve the auto generated primary key field
in the first table during the first insert operation. I cannot go back to
the table and query using the data I inserted since as I mentioned earlier
there can be duplicates. I simply cannot retreive the maximum value since
some other user could have inserted something during that time.
Any ideas?
http://www.php.net/mysql_insert_id
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php