Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Reset ID(int) to last + 1? Re: Reset ID(int) to last + 1?

#96028
bungle
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.