adt2007 Posted July 3, 2007 Share Posted July 3, 2007 hiii im editing an old scriptof mine, and i want to "restart" the id system what i mean is, for example, the next person to register their id will be 229. how do i edit the mysql database so it starts from 1 again? i've removed all users. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 3, 2007 Share Posted July 3, 2007 Just truncate the entire thing. <?php mysql_query("TRUNCATE TABLE users"); ?> In phpmyadmin, you can click on "empty" and it will restart it as well. Quote Link to comment Share on other sites More sharing options...
jscix Posted July 3, 2007 Share Posted July 3, 2007 mysql internally keeps record of auto-incrementing values.. i'm sure you could look it up.. I personally haven't dealt w/ it before.. is there any specific reason you want to start it over? It doesnt really effect anything. Quote Link to comment Share on other sites More sharing options...
wcsoft Posted July 3, 2007 Share Posted July 3, 2007 Two way. If you're deleting all of the data in the table, you can use the TRUNCATE command: truncate tablename That deletes everything, and resets the auto_increment field to 0 Or: ALTER TABLE tablename AUTO_INCREMENT=0; Quote Link to comment Share on other sites More sharing options...
adt2007 Posted July 3, 2007 Author Share Posted July 3, 2007 thanks everyone! Two way. If you're deleting all of the data in the table, you can use the TRUNCATE command: truncate tablename That deletes everything, and resets the auto_increment field to 0 Or: ALTER TABLE tablename AUTO_INCREMENT=0; where do i enter the command? Quote Link to comment Share on other sites More sharing options...
wcsoft Posted July 3, 2007 Share Posted July 3, 2007 Either of those would be done in your mysql manager. phpmyadmin, direct command line on the mysql shell. Basically whatever you use to execute sql commands on your sql server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.