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.