Re: PHP, MySQL and Transaction

From: Date: Fri, 16 Aug 2002 09:52:09 +0000
Subject: Re: PHP, MySQL and Transaction
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-112933@lists.php.net to get a copy of this message
On Friday 16 August 2002 17:37, Christian Ista wrote: > Hello, > > In an MySQL table, I insert some records. Before each insert (just > before), > I do a "Select max() ..." and I increment the result by one, to give a > number (unique), and I have an auto_incremente field too. Not sure why you would have a field that is manually incremented and also one that is auto_incremented. > I'd like to know if there is a mechanism in PHP, if several person do > the same thing in the same moment, to not have several record with the > same number. PHP does not have such a mechanism. You can lock the relevant table, then query, then increment and update value, then unlock table. For further info 1) ask on php-db list 2) ask on mysql list -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* What ever happened to happily ever after? */

« previous php.general (#112933) next »