You are here: Re: UPDATE and increment by 10 « All PHP « IT news, forums, messages
Re: UPDATE and increment by 10

Posted by Arjen on 09/28/21 11:57

version2 schreef:
> Hi Arjen,

Here is how I would consider doing it (hmm come to think of it not
really but it's the simplest solution I could think of)

table tayout
id int(8)(primary key - auto increment)
name
order int(8)

then select all fields (SELECT * FROM blaat ORDER BY order)

print them into a page
echo "page ".$row['id']."-".$row['name']";

then assign an action
echo '<a href = "index.php?a=move_up&id='.$row['id'].'">move up</a>';

then on a = move up
swap or rebuilt the order the values

// select the 2 rows that need to have their order swapped
SELECT * FROM blaat WHERE id = ".$_POST['id']." ORDER BY order LIMIT 2

// do the query
//....

UPDATE blaat set order = $row['1']['order'] WHERE id = $row['0']['id']
UPDATE blaat set order = $row['0']['order'] WHERE id = $row['1']['id']

And for move down order by order DESC

 

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

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