Hello all,
Here's my code...
<?
$query1 = "SELECT AVG(service) AS avgservice FROM reviews WHERE resto_id = '$id'";
$query2 = "SELECT AVG(cadre) AS avgcadre FROM reviews WHERE resto_id = '$id'";
$query3 = "SELECT AVG(cuisine) AS avgcuisine FROM reviews WHERE resto_id = '$id'";
$result1= mysql_query($query1);
$result2= mysql_query($query2);
$result3= mysql_query($query3);
$row1 = mysql_fetch_assoc($result1);
$row2 = mysql_fetch_assoc($result2);
$row3 = mysql_fetch_assoc($result3);
$avgservice = number_format($row1['avgservice'], 2, '.', '');
$avgcadre = number_format($row2['avgcadre'], 2, '.', '');
$avgcuisine = number_format($row3['avgcuisine'], 2, '.', '');
?>
It works! But what a mess...
I was wondering if there was a way to make this shorter and cleaner (with less repetitions).
Thanks in advance!