From 6e9c9434c16ba5b2ce4f7bed73e63e33312c3810 Mon Sep 17 00:00:00 2001 From: Leander Date: Mon, 10 Apr 2017 13:16:30 +0200 Subject: [PATCH] T201704101316 --- highscores.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/highscores.php b/highscores.php index 01a43a4..a5e53d9 100644 --- a/highscores.php +++ b/highscores.php @@ -28,7 +28,11 @@ if($uid == '') { $cat = $category['name']; $score = $db->query('SELECT "score" FROM "Highscores" WHERE "Users_ID" = $1 AND "Categories_ID" = $2', array($uid, $cid))['data'][0]['score']; - $score = $score == null ? 0 : +$score; + if($score == null) { + $score = 0; + $db->query('UPDATE "Highscores" SET "score" = $1 WHERE "Users_ID" = $2 AND "Categories_ID" = $3', + array($score, $uid, $cid)); + } $place = $db->query( 'SELECT COUNT (*) FROM "Highscores" WHERE "Categories_ID" = $1 AND "score" > $2',