how to calculate the total average (user) rating
EXAMPLE: user ratings 20 average 4.3
$result=mysqli_query($connection,"SELECT * FROM rating where to_user_id='".userid."'");
count
$rowcount=mysqli_num_rows($result);
echo $rowcount; // Result 20 ratings
Ratings
while($row = mysqli_fetch_array($result)){
echo $row['ratting'];// 1.0 2.0 4.0.......
?>
My problem how can I calculate the total average
example like a total average of 4.3
please help me