PHP drag sorting, database design issues.

the front end uses plug-ins to drag tree nodes, sends information to the back end through AJAX, and saves data into storage. Now there is a field in the database that is sort (default is 0), which records the sequential location of the nodes.
if I design the data in this way, I will refresh the sort value of all the data in the database by dragging the location of a piece of data. Is there any way to move all the data without dragging one piece of data?

Jun.10,2021

you only need to modify the data before and after dragging, and you don't need to modify all


this kind of business logic had better not be refreshed directly. You can perform batch update operations after the front end adjusts the sorting. According to id, the batch efficiency will not be very slow


decimal. In this way, the degree of operation is much higher. Update the whole when there is no room for operation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea96c2-47d2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea96c2-47d2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?