Jump to content

autoincrement - after deleting rows -


phppatron

Recommended Posts

My question is:

 

If I delete rows in my database via phpadmin, it remembers which row ID had previously been used, so the remaining records are 1, 3, 4, 5, 8  and the rows I deleted  (2, 6, 7) no longer exist.  Is there some means of having the database forget the dropped records, so the numbering is sequential?

Link to comment
https://forums.phpfreaks.com/topic/63453-autoincrement-after-deleting-rows/
Share on other sites

Theres no way of doing it with autoincremented primary column (meaning id), as it would not be called autoincrement. Imagine someone who has bookmarked an article at a page which is articles.php?id=10 and when he returns finds out that its not that article anymore, but it has changed to id=9. Theres no point for doing this.

I really wish sometimes that mysql would allocate unique random numbers instead of sequential ids to stop people complaining because their record ids are no longer neat and tidy. An auto-incremented id is just a unique identifier for that row.

 

see

 

http://www.phpfreaks.com/forums/index.php/topic,140306.msg596840.html#msg596840

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.