Re: How Best to Maintain Sort Order Field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007. 04. 20, péntek keltezéssel 10.47-kor Stephen ezt írta:
> Zoltán Németh wrote:
> > nothing special. just like this:
> > <button name="moveup" onclick="handler.php?cmd=moveup&id=1">
> >
> > and then in handler.php do a switch for cmd and update the rows
> > accordingly, then redirect back to the form
> >
> >   
> Thanks!
> 
> Can you give me idea what the SQL should look like?

please include the list in replies!

btw, it cannot be solved with a single SQL query AFAIK.
for example, move up requires the following steps:
1. get the order value of the record to be moved (simple select)
2. get the record which has one less order value (the record above)
(another select)
3. update the records with the new order values (2 separate updates)

similarly you should be able to define the logic for movement down and
so on...

greets
Zoltán Németh

> 
> Stephen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux