30
May
May
MySQL PHP get average value for column
Hi,
I have tried different ways of doing this but still can’t get the average value for the column VehCondition, can anyone see what I’m doing wrong? It doesn’t return a value for $ConditionRating;
PHP Code:
$Vehicles2=mysql_fetch_array(“SELECT avg( VehCondition ) as ConditionRating, Type FROM vehicles where Userid=’$_SESSION[userid]’ GROUP BY Type”);
$ConditionRating=$Vehicles2[‘ConditionRating’];
echo $ConditionRating;
Relevant Links

