tags:

views:

26

answers:

1

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.. :-(

+2  A: 

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.

Pekka
+1 for remembering the --auto-increment-increment startup option, though it can't be targetted against individual tables, but applies server wide
Mark Baker