You are here: Re: More CMS help « PHP Programming Language « IT news, forums, messages
Re: More CMS help

Posted by Jon on 01/20/06 21:27

I don't understand the query here - If I'm selecting WHERE
SortOrder=(SortOrder+1) - I don't know what sortOrder is. Do I have to pass
the current sortOrder ID within the query string?

"Adam Plocher" <aplocher@gmail.com> wrote in message
news:1137779135.046241.4690@g14g2000cwa.googlegroups.com...
> Does this fix the problem? It will attempt to find the "replaceID"
> automatically. You shouldn't need to shift every item, just the item
> before or after the item you want to move.
>
> function MoveUp($id)
> {
> $query = "SELECT ID FROM table WHERE SortOrder=(SortOrder+1)";
> $ret = mysql_query($query);
> if (mysql_num_rows($ret) == 1)
> {
> // if 0 rows returned, don't change the sortorder
> list($replaceID) = mysql_fetch_row($ret);
>
> $query = "UPDATE table SET SortOrder=(SortOrder-1) WHERE ID=$id"
> mysql_query($query);
>
> $query = "UPDATE table SET SortOrder=(SortOrder+1) WHERE ID=$replaceID"
> mysql_query($query);
> }
> }
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация