Hi, can someone please help me out with the following query?
I want to display the average rating with stars
stars is a number between 0 and 4
$sql_select = mysql_query( "select count(product),avg(stars) from ".$prefix."store_comments where product='$product' and status='1'");
$totalrows = mysql_num_rows($sql_select);
if($totalrows!==0)
{
$counter = 0;
while ($row = mysql_fetch_array($sql_select))
{
$stars=$row["stars"];
if ($stars==0)
{echo"<img src=\"images/stars-1.gif\" width=\"64\" height=\"12\">";}
else if ($stars==1)
{echo"<img src=\"images/stars-2.gif\" width=\"64\" height=\"12\">";}
else if ($stars==2)
{echo"<img src=\"images/stars-3.gif\" width=\"64\" height=\"12\">";}
else if ($stars==3)
{echo"<img src=\"images/stars-4.gif\" width=\"64\" height=\"12\">";}
else if ($stars==4)
{echo"<img src=\"images/stars-5.gif\" width=\"64\" height=\"12\">";}
}
}