6 December 2004

Maintain a sortorder column

Who knew I would find FIND_IN_SET so useful.

It is not uncommon to have a sort column, for alternative ways to sort data. Recently a client requested a GUI to change sort order of how “data” is returned to their end user.

Using my new found knowledge of “FIND\_IN_SET” which I spoke about in the Sort by specific ID, I quickly whipped up a HTML/Javascript GUI that allows users to move items up and down in a select list…

When they are happy they can submit… and sortorder column reflects how they feel data should be ordered.

Here is the SQL code that is run … where “1,2,3, ....” is the order that user wants.

UPDATE TABLE tablename
SET sortordercol = FIND\_IN_SET(id, "1,2, 3...") 
 

Comment



note: you can only submit after you hit preview


nuff-respec is a weblog written by daniel bulli a senior web programmer in boston, ma.
more >

contact | resume | profile | twitter

recently :::

diversions :::

45+ Amazing Insect Shots in Photography
Insects are one of the most fascinating creatures on earth. There are more than 800, 000 species of insects in the world.
Grayscale color | Stroep Blog
This is how I create a grayscale color in actionscript 3.
Google Flash API
This is great ... google has made this easy ... stay tuned to see what i am working on ...
25 Free Mac Apps That Will Boost Your Productivity
There are many applications that can help you work faster and efficiently. Though, not many applications come cheap.
you still want more »