asmith Posted November 25, 2007 Share Posted November 25, 2007 $sql = "create table aaa(id int NOT NULL AUTO_INCREMENT, username varchar (30),PRIMRY KEY (id))"; i created a table just like that , i added one user name , it gave the id , 1 . then i deleted the username, and do a select * from table, it said it is empty, i inserted another username, it gave id ,2 ! can i make it to give the id 1 again ? Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/ Share on other sites More sharing options...
revraz Posted November 25, 2007 Share Posted November 25, 2007 This would be a MySQL issue, not really a PHP one. Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/#findComment-398813 Share on other sites More sharing options...
asmith Posted November 25, 2007 Author Share Posted November 25, 2007 php and mysql are like brothers ! or father and son ! Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/#findComment-398814 Share on other sites More sharing options...
rarebit Posted November 25, 2007 Share Posted November 25, 2007 Sorry, took a while to find, also been a few posts since i last looked at it: http://www.phpfreaks.com/forums/index.php/topic,159599.0.html, it also refers to other posts... Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/#findComment-398817 Share on other sites More sharing options...
shedokan Posted November 25, 2007 Share Posted November 25, 2007 I had the same problem here's the solution: ALTER TABLE yourtablehere AUTO_INCREMENT=1 Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/#findComment-398830 Share on other sites More sharing options...
fenway Posted November 26, 2007 Share Posted November 26, 2007 Use TRUNCATE TABLE if you want to delete everything -- otherwise, leave the auto increment field alone. Link to comment https://forums.phpfreaks.com/topic/78806-auto-increment/#findComment-399367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.