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
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.