Jump to content

Re-sorting table order after deleting some entries?


Chappers

Recommended Posts

Hi all,

I've got a MySQL database set up in which I have a field set as primary key and named ID, and auto_increment. As I display the elements sorted by ID order, I have the number of each entry in the table in numerical order going down the page, just as I want. But, if I delete any of the entries in the table, the numbers set for each ID remain static, so I might end up with:

ID: 1 Name: blah
ID: 3 Name: blof
ID: 4 Name: blag

where ID: 2 is missing because it's been deleted. Is there a way I can make the table re-sort itself so after deleting the above entry ID:2, the remaining table would be:

ID: 1 Name: blah
ID: 2 Name: blof
ID: 3 Name: blag

Thanks,
James
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.