Posted by Michael Fesser on 07/20/07 21:16
..oO(Sanders Kaufman)
>newbie wrote:
>
>> Thanks for the answer. But I undersatnd mysql_insert_id() is to
>> 'Retrieves the ID generated for an AUTO_INCREMENT column by the
>> previous INSERT query.'. How to deal with the situation that multi-
>> users insert rows concurrently?
>
>That's only a problem if you use the SELECT method.
Nope.
>If you use mysql_insert_id or (whatever that command is) it gets the
>last insert *on that connection*.
So does LAST_INSERT_ID(). The last auto-generated ID is maintained by
the server on a per-connection basis. It doesn't matter if you use a
SELECT statement or an API call to retrieve it.
Micha
Navigation:
[Reply to this message]
|