简体   繁体   中英

Setting the AUTO_INCREMENT of userid

guys, how can i set the auto_increment of my userid something like this:

i want to start it in 200, then increment by 10 with a maximum value of 1000..

how will i code it using php?

please help me.. :-(

You can set a starting point to an auto increment value, but the rest you ask (increasing by 10, and limiting at 1000) is impossible on the mySQL level.

You would need to do this in your PHP code, as a pre-check before creating a new user account. Also, I would recommend doing this in a separate, indexed int column.

Update: There is the auto_increment_increment mySQL setting but it seems replication speficic, doesn't apply to your normal, single-database, myISAM setup, and is applied database-wide - it's not what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM