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

Posted by number1.email on 04/29/06 19: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?

Thanks...

 

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

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