Jump to content

Reorder MySQL Rows


Omzy

Recommended Posts

I have a HTML dropdown list which is populated from a MySQL table. I use an auto-incremend ID field. I have also got a sort_order field.

 

I would like to be able to specify the exact order that entries should appear in the dropdown list. Specifically I need some functionality that does the following two things:

 

1) If I change the sort order of a record to for example "4" then the existing record with sort_order 4 becomes 5, sort_order 5 becomes 6 and so on.

 

2) If I change the sort order of a record to for example "4" and there is currently no record with sort_order 4, then no other records will be updated.

Link to comment
https://forums.phpfreaks.com/topic/214947-reorder-mysql-rows/
Share on other sites

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.