Hi, I have a table with a list of records, and a column called order. I have an AJAX script to drag and drop the table rows up or down which I want to use to perform a query, reordering the rows as they have been dragged.
In the PHP, I perform a query to get the current order of the records. eg 1, 2, 3 ,4 The AJAX function passes the new order after the drag/drop is complete, eg 3, 1, 2, 4
Is there a simple way to re-order the records in one go, based on the new values? The only other alternative I can see is looping through UPDATE statements eg SET order = 1 where order = 3
But surely this would result in 2 records having the same value?
Apologies, I know this description may be slightly confusing.