So, I have a table like this:
*******************
id | name | position
-----|---------|---------
1 | record1 | 1
24 | record | 2
45 | record | 3
122 | record | 4
*******************
I need to change the field values with places, for example
id 122 to position 3 and id 45 to position 4.
I tried to do so
-------------------------
Code: Select all
mysql_query("UPDATE `data` SET `position` = `position` - 1 WHERE `id` = ". $id);
mysql_query("UPDATE `data` SET `position` = `position` + 1 WHERE `id` < ". $id);but it's not working as needed. Help me, please. (and sorry for my english )