T201704101316

This commit is contained in:
Leander
2017-04-10 13:16:30 +02:00
parent 766b226f84
commit 6e9c9434c1

View File

@@ -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',