onthespot Posted July 13, 2009 Share Posted July 13, 2009 Whats the best way to go about making a rating system for user profiles on my website? So there needs to be a rating for each and every member on the site, but user's should only be able to vote once for each member. Then the members entire votes will be counted and divided by the amount of votes to get the average. I just can't quite get my head around how to do this! Link to comment https://forums.phpfreaks.com/topic/165847-rating-system/ Share on other sites More sharing options...
nbarone Posted July 13, 2009 Share Posted July 13, 2009 a table for ratings ____________________________________________________ rate_id | rate_user | rate_rater | rate_value | rate_timestamp ------------------------------------------------------------ check to see if rate_rater has already rated rate_user, if mysql_num_rows returns 0 on that, allow the rate to happen then SELECT * FROM ratings WHERE rate_user='1' and while($row = mysql_fetch_array($result)){ $rating += $row['rate_value']; } then $final_rating = ($rating / mysql_num_rows($result)); Link to comment https://forums.phpfreaks.com/topic/165847-rating-system/#findComment-874787 Share on other sites More sharing options...
onthespot Posted July 13, 2009 Author Share Posted July 13, 2009 Ok thats very helpful, if anyone else can give me more guidance would be of great help, i will try and make some sense of this now.. Link to comment https://forums.phpfreaks.com/topic/165847-rating-system/#findComment-874799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.