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/
> ---------------------------------------------------
> 

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

Reply via email to