I tend to (if I can't use mysql_last_id) insert a unique key into the row,
and pull the row out that matches that key, in order to get the ID...
ensures that it was the right row... then you can delete the unique key.

Justin


on 18/09/02 10:27 PM, Jon Haworth ([EMAIL PROTECTED]) wrote:

> Hi Bob,
> 
>> SELECT idno ORDER BY idno DESC LIMIT 1;
>> assuming idno is what gets auto incremented
> 
> That's not the best idea - what happens if two users are inserting records
> into the table at nearly-but-not-quite the same time?
> 
> 1. Insert A goes through
> 2. Insert B goes through
> 3. LastID A returns the ID of B
> 4. LastID B returns the ID of B
> 
> Whoever did insert A would receive the wrong ID.
> 
> Cheers
> Jon


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

Reply via email to