Re: running number

From: Date: Mon, 25 Jul 2005 10:22:39 +0000
Subject: Re: running number
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-219296@lists.php.net to get a copy of this message
try mySQL's auto increment attribute http://dev.mysql.com/doc/mysql/en/example-auto-increment.html Roger Thomas wrote: > I am required to write a user registration script that captures the basics like name, phone > number etc etc. I would also have to write to mySQL database a number that is associated with that > user. > > At this point of writing, the start of that number is unknown. But the number will be > incremented by 1 after each successfull registration. > > Let's say the number starts from 12345. > > I am quite new at all these stuff and would like to seek your advise on the *recommended way* > of achieving this. I am thinking along these lines: > a) store that number (12345) in a table > b) a user registers and assign that number to him > c) increment number to 12346 > d) process repeats for the next registration > > Concern: How do tell mySQL to lock the 'number' table when a new registration process > is about to take place. Is locking the best option here or is/are there better ways? > > Please advise. > > -- > Roger > > > --------------------------------------------------- > Sign Up for free Email at http://ureg.home.net.my/ > --------------------------------------------------- >

« previous php.general (#219296) next »