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

Menu