Author Topic: Algorithm to order my records  (Read 113 times)

0 Members and 1 Guest are viewing this topic.

Offline adambedfordTopic starter

  • Enthusiast
    • View Profile
Algorithm to order my records
« on: February 08, 2010, 09:33:18 AM »
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.

Offline kathas

  • Enthusiast
    • View Profile
    • Greek Job Search Engine
Re: Algorithm to order my records
« Reply #1 on: February 10, 2010, 01:14:52 PM »
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
Greek Job Search Engine - Seriously Greek

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.