You can implement this by doing the following:
- Add a column in the database and call it
class_order
- Your SQL query should have
ORDER BY class_order
- Moving up
UPDATE table set class_order = THE_ORDER_OF_THE_CLASS_ABOVE WHERE id = TARGET_CLASS
andUPDATE table set class_order = TARGET_CLASS_ORDER WHERE id = THE_CLASS_ABOVE
- Moving down is the opposite of moving up
1
solved php – data entry and order issue [closed]