Home › Forums › Back End › Reset ID(int) to last + 1? › Re: Reset ID(int) to last + 1?
February 2, 2012 at 2:17 pm
#96028
Member
no, you need to do first
mysql_query(‘DELETE from memes WHERE id = ‘.$idtoremove);
then follow it with
mysql_query(‘ALTER TABLE imgtable AUTO_INCREMENT = (( SELECT MAX(id) FROM imgtable ) + 1 )’;
which will reset your auto increment down if the image deleted was the last image.