guttyguppy Posted March 12, 2008 Share Posted March 12, 2008 Hi, a site I'm working on has a list of about 40 employees-a picture, name, and brief bio, followed by the next one, etc. The client can add, edit or delete the employees, but they also want to reorder them. I'm having a hard time looking at this from a programming view. If I add a new column to the mysql db called "rank", plug in defaults, and have the results sort by that, I think that's a start. But if they move employee #6 to the #12 spot, for instance, 7,8,9,10,and 11 need to drop by one, and 12 and up need to go up one. I could make them manually enter all this, but it seems like a major hassle for something that could easily be programmed. What's the best way to do this? Thanks for any advice. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 12, 2008 Share Posted March 12, 2008 Code to adjust all ranks between $oldrank and $newrank to add one to itself. Quote Link to comment Share on other sites More sharing options...
guttyguppy Posted March 12, 2008 Author Share Posted March 12, 2008 That makes sense; I guess 12 and up don't change at all in my example. Thanks; I'll play with it for a while. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.