diff --git a/allhighscores.php b/allhighscores.php index 7ea9935..f5d0148 100644 --- a/allhighscores.php +++ b/allhighscores.php @@ -29,16 +29,18 @@ if($cid == -1) { WHERE h."Categories_ID" = $1 ORDER BY COALESCE(h."score", -1) DESC LIMIT $2 OFFSET $3', array($cid, $limit, $offset))['data'];*/ - $overview = $db->query('SELECT u."name", h."score" + $overview = $db->query('SELECT u."name", COALESCE(h."score", -1) AS "c_score" FROM "Users" u LEFT OUTER JOIN (SELECT "Users_ID", "score" FROM "Highscores" WHERE "Categories_ID" = $1) h ON u."ID" = h."Users_ID" - ', array($cid))['data']; + ORDER BY "c_score", u."name" + LIMIT $2 OFFSET $3 + ', array($cid, $limit, $offset))['data']; print_r($overview); foreach($overview as $row) { $name = $row['name']; - $score = $row['score']; + $score = $row['c_score']; //$score = (isset($score) AND $score != NULL) ? ($row['score']) : -1; $place = $db->query('SELECT COUNT(*) FROM "Highscores" WHERE "score" > $1 AND "Categories_ID" = $2', array($score, $cid))['data'][0]['count'] + 1;