I am developing a star rating system with 1-5 stars. In my database I am saving them like this:
$stars_1 = 1; $stars_2 = 6; $stars_3 = 3; $stars_4 = 11; $sta
You need to multiply the number of stars with the actual rating. Like
$points_stars_2 = $stars_2 * 2 ... $points_stars_5 = $stars_5 * 5
And then you add them all to one variable like in your code, and then divide it by $total_votes.
$total_votes
Regards