I want to use the avg() function. I have a table with a column called "blue". In this column there are verious numbers ranging from 1-9. I want to get the average number from this column for a particular user. Here is the code I am using, but it won't work. Can someone please show me where I am going wrong?
Thanks for any advice.
Owen the Samoan
$result = mysql_query("SELECT avg(blue) FROM rate WHERE user_id='$user_id'") or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
$blue = $row["blue"];
}
echo $blue;