Hi all!
I've been writing PHP code for quite a few years now, but I think I've just gotten in over my head. I'm a decent programmer, but I'm by no means a master.
I'm trying to write some code that will allow a user to arrange a group of links by their own preferance. The links are stored in a database, and I'd like to store a numerical value in the database as well to sort the links when the user views them (ie: link 1 goes at the top, link 2 underneath that, etc...).
Here's my problem: I'd like to make it as easy as possible on the user. If the user decides to move 'link 4' to the 'link 1' position I'd like the code to auto-adjust all the way down - filling the gaps - and then storing the new values in the database.
I'd guess my core question would be: How do I go about modifying the array to auto-arrange numbers and fill any gaps?
Any help, pointers or tips would be greatly appreciated. Thank you for reading this!
-Jack