mysql_db_query & INSERT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Thanks in advance.

Cheers,

Prathap

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux