> 1. user A insert into table (get id = 1 from auto increment value)
> 2. user B insert into table (get id = 2 from auto increment value)
> 3. user A get value from $id = LAST_INSERT_ID() (id = 2)
> 4. user B get value from $id = LAST_INSERT_ID() (id =2)
[8<]
> How can we make sure that those 3 processes are atomic operation (insert
> table -> get id from LAST_INSERT_ID() -> update table) ??

>From the MySQL 5.0 manual (20.9.10.3):

For LAST_INSERT_ID(), the most recently generated ID is maintained in
the server on a per-connection basis. It is not changed by another
client. ... Using LAST_INSERT_ID() and AUTO_INCREMENT columns
simultaneously from multiple clients is perfectly valid. Each client
will receive the last inserted ID for the last statement /that/ client
executed.

http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html

Ben

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

Reply via email to