I have the following:
<?php
include 'connect.php';
//get average from all reviews
$allreviews = "SELECT round(avg(Stars_overall),0) AS average FROM (SELECT Stars_overall FROM Reviews WHERE Meal_ID = 1 ORDER BY Order_ID DESC LIMIT 5) AS Average";
$getresult = mysqli_query($conn, $allreviews);
$row3 = mysql_fetch_assoc($getresult);
echo "aaaaa" .$row3['average']. "bbbbb";
mysqli_close($conn);
?>
Unfortunately it is not working, any clue why? It is for a review system, i'm trying to display an average of star ratings stored in database. The first sql gets all the ratings for a specific meal and the second sql calculates the average. I then want to be able to display the average