Jump to content

Numbering rows in a database?


membot

Recommended Posts

Sorry if this belongs in the MySQL section. I figured it might be more of a PHP thing.

I have a database where rows each have a number, which is used to determine what order they appear in on my PHP page. But right now they aren't like 1, 2, 3, 4, etc. They are a little jumbled because of deleting some and changing some, so they're more like 1, 3, 7, etc. Is there a way to make them 1, 2, 3, 4 with PHP? Like, put them in order and number them accordingly?

Thanks. :D

Link to comment
Share on other sites

Well the thing is, I'm making an admin for the site, so the user will see these numbers and be able to change them. The idea is that if for example they want to put in a new row between rows 2 and 3, they could type 2.5 for the row number. Then when they save it and refresh the page, the rows are ordered with integers again. I've seen this exact thing done on other sites. Maybe it's not very efficient, but it'll do for me.

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.