On Thu, 2008-04-24 at 10:24 -0700, zhade12 wrote: > Hi please i need help on what to alter below so if i delete a message > in php my admin, the messages will still count in order. Right now if > i delete message 1 > it starts numbering from 2 > Thanks for your replies > > CREATE TABLE `guestbook` ( > `id` int(4) NOT NULL auto_increment, > `name` varchar(65) NOT NULL default '', > `email` varchar(65) NOT NULL default '', > `comment` longtext NOT NULL, > `datetime` varchar(65) NOT NULL default '', > PRIMARY KEY (`id`) > ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Execute the code (click on SQL in phpmyadmin): ALTER TABLE TableName AUTO_INCREMENT=12345; This should set the next increment value to 12345 ... if memory serves me right.... The mysql command to reset it all is truncate but this will wipe it all. I have one suggestion for table design. When creating the id column, use UNSIGNED as it does not allow for negative integers and at the same time gives you a greater range of positive integers. Like so: `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,