Thanks for the the quick response, Ken! Unfortunately, that didn't do the trick either. Here is what my code looks like now per your request:
function avg_of($column_name) {
global $connect_db;
$query = "SELECT user_id, AVG($column_name)as my_avg FROM table GROUP BY user_id";
$result = mysql_query($query, $connect_db);
$row = mysql_fetch_assoc($result);
$average = $row[' my_avg'];
$round_val = round($average, 1);
return $row;
I'm not getting a zero as the average when it should be '5'. If I return $row instead of $round_val, I get "Array ( [user_id] => 64 [my_avg] => 5.0000 )". For some reason it doesn't seem like the extraction of the 'my_avg' key from the $row array is working. Any other thoughts?
Thanks again for you help!