adambedford Posted February 8, 2010 Share Posted February 8, 2010 I'm writing a script where I need to order my results based on two things: the number of hits they receive, and the date the record was created. Ideally, I want the most popular records at the top (or do I, I'm not sure of this yet!) but I also need newly created records to have a chance of receiving hits (ie. if they are new and don't have any hits, I don't want them to be at the bottom from the get-go and not have a chance of being seen.) My hits are recorded in a separate table and the 'date created' field is in the main table. Does anyone have any idea as to how I can organise these records to that the new ones get a fair chance of getting clicked. I also want to avoid the situation where the most popular ones remain at the top and don't allow the others a chance to get clicked. I don't want these records to spiral out of control with regards to hits. I'm relatively new to PHP and I don't really have a clue where to start with this. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/191359-algorithm-to-order-my-records/ Share on other sites More sharing options...
kathas Posted February 10, 2010 Share Posted February 10, 2010 How about having three different sections Most Popular - 5 entries New - 5 entries Random - 5 entries So you give a chance for clicks to every result. But seriously i think that this shouldn't be in the Math Help Link to comment https://forums.phpfreaks.com/topic/191359-algorithm-to-order-my-records/#findComment-1010230 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.