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
https://forums.phpfreaks.com/topic/236991-numbering-rows-in-a-database/
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.

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.