I'm looking for a snippet that will change the order of a list. Before I write it, I might as well ask if someone has done this already.

Consider a table
id -- unsigned int, autoincrement
order -- unsigned int
name -- char

I display the table
ID      ORDER   NAME    <UP>      <DOWN>
1       1               first   up1             dn1
2       2               second  up2             dn2
3       3               third   up3             dn3

The <UP> and <DOWN> columns contain links to move a row up or down, something like:
?_function=up&_uid1=<@COLUMN "id">
?_function=dn&_uid1=<@COLUMN "id">

Say I hit the up2 link, I then get the table in a new sort order:

ID      ORDER   NAME    <UP>      <DOWN>
1       1               first   up1             dn1
3       2               third   up3             dn3
2       3               second  up2             dn2

Of course there might be <TOP> and <BOTTOM> links too.

thx.

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to