';
$rating_query = "SELECT ROUND(AVG(rating),1) AS avg_rating, COUNT(*) AS count FROM reviews WHERE product_id='$p_id'";
$run_query = mysqli_query($con,$rating_query);
$row = mysqli_fetch_array($run_query);
$r_count = $row['count'];
if($row > 0){
$avg_count=$row["avg_rating"];
echo '
'.$avg_count.'
';
$i=1;
while($i <= round($avg_count)){
$i++;
echo'
';
}
$i=1;
while($i <= 5-round($avg_count)){
$i++;
echo'
';
}
echo'
';
}
echo'
';
$i=1;
while($i <= round($avg_count)){
$i++;
echo'
';
}
$i=1;
while($i <= 5-round($avg_count)){
$i++;
echo'
';
}
echo'