I'm trying to create the most efficient way to allow a user to change the display order of a group of rows in a table.


Lets say the basic table is:

id
group_id
name
sort_order

The query to display it would be

"SELECT id, name FROM mytable WHERE group_id = $x ORDER BY sort_order"

Now when I display it they currenlty all have the same sort_order value so they come in the order however the db finds them.
In my PHP app... I have a small arrow that allow them to move a row up or down changing the display order.


Currently this is done by looping through the results of all the items in a group and reassigning a new sort_order value to each one.
Meaning 1 SELECT and MANY updates (1 for each item in the group).


I was wondering if anyone has come up with a better way to do this.


Thanks, Mike



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to