Jump to content

rating system


onthespot

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.