I am making a scoreboard from a table where members details are stored in one table and scores are stored in another with members foreign keys. I know that I can show the leaderboard with:
$lbquery = mysqli_query($conn, "SELECT mid, SUM( score ) AS count FROM `memberscores` GROUP BY mid ORDER BY count DESC");
$lbrow = mysqli_fetch_array($lbquery);
$memid = $lbrow["mid"];
$memscore = $lbrow["count"];
$memquery = mysqli_query($conn, "SELECT firstname, lastname FROM `members` WHERE `mid`=".$memid);
$memrow = mysqli_fetch_array($memquery);
$fname = $memrow["firstname"];
$lname = $memrow["lastname"];
echo $lname." ".$fname." = "$memscore;
But I am confused how will show the first ten as it seems that may I have to use a loop to show the first ten in a table. but not sure how it will be used.