T201704051348

This commit is contained in:
Leander
2017-04-05 13:48:12 +02:00
parent 2b104e943d
commit 292dd868bb

View File

@@ -47,7 +47,9 @@ if($uid == '') {
$new_time = $old_time + $time;
$db->query('UPDATE "Games" SET "total_time" = $1 WHERE "ID" = $2', array($new_time, $uid));
//set high score
//set highscore
$cid = $db->query('SELECT "current_category" FROM "Games" WHERE "ID" = $1', array($uid))
['data'][0]['current_category'];
if($db->query('SELECT EXISTS (SELECT 1 FROM "Highscores" WHERE "Users_ID" = $1 AND "Categories_ID" = $2)',
array($uid, $cid))['data'][0]['exists'] == 'f') {
$db->query('INSERT INTO "Highscores" ("Users_ID", "Categories_ID") VALUES ($1, $2)', array($uid, $cid));