This is a combination of jQuery and a PHP problem so I'm not 100% certain where to post it.

I am working on method to reoder a list that comes from a database. When the lists is displayed, it will be ordered by a "sort" column. The user can drag/drop the list to change the order, and I want the order to update the sort values in the database.

I found a script that provides a decent starting point, but I am not getting the results I want.

1: It is able to reorder the columns, and save the results which is good.2: It is saving the results as "0,1,2,3" rather than reordering the numbers from the "sort" column. (< this is what I need fixed)

EG: Name > SortApple 3Orange 5Pear 13Kiwi 105

If I reorder these in the reverse order using the script, I end up with the following in the database.Apple 3Orange 2Pear 1Kiwi 0

Yet what I want is,Apple 105Orange 13Pear 5Kiwi 3

Are there any suggestions how I can get it to work with the existing "sort" values, rather than serializing and starting at 0.