|
Posted by Oli Filth on 04/29/06 20:14
number1.email@gmail.com said the following on 29/04/2006 17:54:
> I have a question regarding incrementing records in a mySQL Database
> Table. For example, if the User Table has a UserID field as the
> primary index, I could always Select the MAX(userid) field, increment
> it, and add a new user this way. Problem is, what if someone also
> requests this same userid before I "insert" my record? This would
> cause a problem as it is not unique... In Oracle you can "Select <val>
> from dual", which is automatically updated...so no person gets the same
> number. Does mySQL have something similar, like a counter field? How
> do I go about this?
>
http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html
--
Oli
Navigation:
[Reply to this message]
|