List:General Discussion« Previous MessageNext Message »
From:Scott Haneda Date:July 16 2004 1:10am
Subject:Allowing user orderable sorting
View as plain text  
I have been tryying to come up with a way to deal with this without adding
too much bloat in server side code, was hoping someone could help me with
some SQL to make this easier.

Mysql 4
Given a simple case a table 'data' with 'sort_order' and 'copy'

I currently list the images, ordered by 'sort_order, added'
Added is a timestamp(14) date time field.

In my ordered list I want to have links that will allow one to move the
record up and down in the returned list of results.  The default sort_order
is '0'.

The best I can tell, I have to select all the sort_order values, which I
already do, if a result set looks like this

sort_oder       copy
0               a
0               b
0               c
0               d

If the user clicks on "move up" on the "c" record, it should move up, before
"b" and after "a".

I have done this in the past, the code to support it was not my definition
of elegant, looking for some suggestions.
Scott Haneda                                Tel: 415.898.2602                       Fax: 313.557.5052
scott@stripped                            Novato, CA U.S.A.

Allowing user orderable sortingScott Haneda16 Jul