From b6b2010e6c4579dfe0cb122ad79d294920c1bbf6 Mon Sep 17 00:00:00 2001 From: Leander Date: Mon, 10 Apr 2017 13:46:29 +0200 Subject: [PATCH] T201704101346 --- allhighscores.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/allhighscores.php b/allhighscores.php index 5ceb625..3d00386 100644 --- a/allhighscores.php +++ b/allhighscores.php @@ -13,11 +13,12 @@ $limit = isset($_GET['limit']) ? $_GET['limit'] : 10; $offset = isset($_GET['offset']) ? $_GET['offset'] : 0; $db = new Database(); -$overview = $db->query('SELECT "name", "highscore" FROM "Users" LIMIT $1 OFFSET $2', array($limit, $offset))['data']; +$overview = $db->query('SELECT "name", "highscore" FROM "Users" LIMIT $1 OFFSET $2 + ORDER BY "highscore" DESC', array($limit, $offset))['data']; foreach($overview as $row) { $name = $row['name']; $score = $row['highscore']; - $place = $db->query('SELECT COUNT(*) FROM "Users" WHERE "highscore" > $1', array($score))['data'][0]['count']; + $place = $db->query('SELECT COUNT(*) FROM "Users" WHERE "highscore" > $1', array($score))['data'][0]['count'] + 1; $data[] = array('place' => $place, 'name' => $name, 'score' => $score); }