Quote:
Originally posted by Fallon
When the voter sees the pic/story/etc, they vote on it, it gets added to the current rating then divide it by two. If you wanted to record the complete total, you'd need to probably make an array which would probably get kinda ugly.
|
If I see this correctly any vote would weigh the same as all previous votes combined...
I'd say store the total awarded points (the sum of all votes) in the 'rating' column and the total number of votes in the 'num_votes' column. When a user votes, add the value to 'rating', and add 1 to 'num_votes'. The average vote is then 'rating' / 'num_votes'.
This way there is no need for an array... (don't know how you figured that?)
If you want one vote per user (and thus a login type system) use the second, more elegant, solution by
Fallon