exeterdad Posted May 16, 2006 Share Posted May 16, 2006 I don't even have a clue how to go about this.Basically I'm creating a PHP/MySQL site from the ground up. One because I want to understand everything that is going on with the code so I will be able to work on it. I guess I'm making a lite CMS.I have a nice template made, a "backend" so I can write/edit/delete "articles". And many other useful features created.But what I can't figure out, is how to make each article appear in a particular order.I don't know if this is something that is done purely with MySQL or what? I'm not talking about sorting acsending or decending, or by the date. I need to assign a order to the articles, and when I decide that another article should be shown up higher on the list, how will the order of the other articles be updated?I'm not looking for someone to write me the code. But I can't figure out what keywords to Google with to find the answer for myself.Any insight would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
rburch Posted May 16, 2006 Share Posted May 16, 2006 The easy way to do this is by date, but if you don't want to do it that way...The only other way to do this, that I can think of, is to place them in an order by reference number, then when you add a new article, your script adds +1 to each reference number - bumping each one down in the list of ordered articles [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] . Quote Link to comment Share on other sites More sharing options...
exeterdad Posted May 16, 2006 Author Share Posted May 16, 2006 So your suggesting that I add another colum to my articles table and name it something like "appearance", assign each article a "appearance number"Then when I add or edit another article and want it to appear in let's say the 5th slot, I have a function increment each "appearance number" in the table greater than 5?Then have a function that does the exact opposite when that article is deleted?Then when my script displays the article, it sorts them ascending using the numbers from my new "appearance" colum?BTW I'm really thankful for your input. 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.