I previously submitted a question about how to setup a table in a db to allow a CMS admin to control the sort order of navigation (see thread titled: "function to move a record up or down in the database". The recommended solution was to add another column in the table that would handle the sort order. For example:
auto_id | link name | parent | text | sort
1 | About | 0 | text text | 1
2 | Mission | 1 | text text | 2
3 | Contact | 0 | text text | 3
4 | Forms | 0 | text text | 4
(Where Mission is the child of About)
However, I'm still having trouble figuring the code that would allow the user to move an item up or down. I'm thinking that the logical steps would possibly be:
Update the table where auto_id = 3 (for Contact) by subtracting 1 from sort to make sort = 2 (assuming the user wanted to move Contact above Mission)
Then, search for the record equal to Contact's new sort number and add 1 to it
Will this work?