Thread: Hi Help With Rating System

1. New Member
Join Date
May 2008
Posts
1

Hi Help With Rating System

Hello
I have a rating system. These are the values i store for each rating: Number of Votes, Previous Rating, Current Select Rating.
Which is the best way (formula) to calculate average rating??
Thanks for your help!

2. Junior Guru
Join Date
Mar 2004
Location
Cleveland, Ohio
Posts
182
Total Number Possible / Total Number users have voted times 100 gives a percentage if thats what your looking for.

3. Aspiring Evangelist
Join Date
Dec 2007
Location
Lebanon
Posts
413
yes that is the formula for all ratings I guess

4. Web Hosting Guru
Join Date
Feb 2003
Location
L.A. C.A.
Posts
335
If its MySQL, MySQL does have an AVG() function for columns :]

5. Junior Guru Wannabe
Join Date
Mar 2005
Posts
53
If it was me I would have created a special table for votes like that:
vote_id,item_voted,vote,date

And then do a select query for all the votes for a specific voted (the actual item voted).
Then when you have all the rows, calculate the average of all the "vote" field in all rows.
That way you can then manage your votes and delete/edit them if necessary.

6. Aspiring Evangelist
Join Date
Dec 2007
Location
Lebanon
Posts
413
Originally Posted by shreder
If it was me I would have created a special table for votes like that:
vote_id,item_voted,vote,date

And then do a select query for all the votes for a specific voted (the actual item voted).
Then when you have all the rows, calculate the average of all the "vote" field in all rows.
That way you can then manage your votes and delete/edit them if necessary.
logically speaking that is the best way to be done!

7. Junior Guru Wannabe
Join Date
May 2008
Location
Rutherford, NJ
Posts
68
assuming number of votes includes the one stored as current select:

((previousrating * (numbervotes-1)) + selectedrating) / (numbervotes)

if the number of votes does not include the current, just switch it to:

((previousrating * numbervotes) + selectedrating) / (numbervotes+1)

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•