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]
|