List:MySQL and PHP« Previous MessageNext Message »
From:Kevin Waterson Date:August 6 2007 6:37am
Subject:Prevent Race Condition
View as plain text  
Hi all,

I wish to get the next id from a field.
Currently I can
SELECT MAX(id) FROM table

but of course, this leads to a race condition with many users.

How can I get around this?
Do I need to lock the table?

Kind regards
kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."
Thread
Prevent Race ConditionKevin Waterson6 Aug
  • Re: Prevent Race ConditionUlf Wendel6 Aug