This is what I got, UPDATED
$avg_query = "SELECT AVG(rating) AS avg_rating
FROM kicks
WHERE userid = '$userid'";
$avg_result = mysqli_query($cxn, $avg_query) or die("Couldn't execute query.");
$row = mysqli_fetch_assoc($avg_result);
$average = $row['avg_rating'];
Every time I echo it out, it always returns array. Never used this function before, but i don’t understand why it would do that.
Shouldn’t you be assigning to $row here?
I’d also suggest using an alias when you are selecting the result of a function call:
If this still doesn’t give any result it is probably because:
In the second case you can fix it by filtering out those rows: