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. Link to comment https://forums.phpfreaks.com/topic/58294-id/ 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. Link to comment https://forums.phpfreaks.com/topic/58294-id/#findComment-289019 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. Link to comment https://forums.phpfreaks.com/topic/58294-id/#findComment-289020 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; Link to comment https://forums.phpfreaks.com/topic/58294-id/#findComment-289021 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? Link to comment https://forums.phpfreaks.com/topic/58294-id/#findComment-289027 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. Link to comment https://forums.phpfreaks.com/topic/58294-id/#findComment-289030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.