Jump to content

Setting display order according to rank in PHP/MySQL


jakeoh

Recommended Posts

Hi,

 

I am doing a simple CMS application for someone.

 

On one page, the members of an association are listed. I want to give the CMS user the possibility to add and remove persons from the table, and to decide the order in which they are displayed (not alphabetically).

 

Now my first idea is to create a "rank" column in the table, and then to order by this column when making the query.

 

My question is: is it possible to have the user select the rank from a drop-down list, and then to update all other values in the column to a new value so that every rank is unique? For example, if the user selects "3" for "John Smith", then the current person with the "3" value will be bumped to 4, "4" bumped to 5, etc.? What would be the best way to achieve this?

 

Thanks!

don't feel like explaining how to do that, but to keep all the user id's unique is simple. all you have to do is set the field to autoincrement, and you won't ever have to worry about them doubling up.

Thanks. However I am talking about a user selected "Rank" column or something similar, not the user ID.

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.