In my Products table I have a column called 'order' which contains integers 1, 2, 3 etc which are set by a drop down box by the user in the CMS.
I want to be able to re order all rows in the DB by passing the old order, new order and product ID accordingly when the user changes the order of a certain product.
Eg:
Chair - order 1
Pillow - order 2
Bed - order 3
Couch - order 4
If the use changes Couch to be order 2, I need to reset all other products according to this change.
Optimisation is not a huge concern as there wont be many items in the table.
What is the most efficient logic for this task?
Thanks