You are here: Re: mySQL, Best Way to Increment Records « All PHP « IT news, forums, messages
Re: mySQL, Best Way to Increment Records

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация