T201704200931
This commit is contained in:
@@ -17,7 +17,7 @@ $db = new Database();
|
||||
if($cid == -1) {
|
||||
$overview = $db->query('SELECT "name", "highscore" FROM "Users" ORDER BY "highscore" DESC
|
||||
LIMIT $1 OFFSET $2', array($limit, $offset))['data'];
|
||||
foreach ($overview as $row) {
|
||||
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'] + 1;
|
||||
@@ -29,13 +29,20 @@ if($cid == -1) {
|
||||
WHERE h."Categories_ID" = $1
|
||||
ORDER BY h."score" DESC
|
||||
LIMIT $2 OFFSET $3', array($cid, $limit, $offset))['data'];
|
||||
foreach ($overview as $row) {
|
||||
foreach($overview as $row) {
|
||||
$name = $row['name'];
|
||||
$score = $row['score'];
|
||||
$place = $db->query('SELECT COUNT(*) FROM "Highscores" WHERE "score" > $1 AND "Categories_ID" = $2',
|
||||
array($score, $cid))['data'][0]['count'] + 1;
|
||||
array($score, $cid))['data'][0]['count'] + 1;
|
||||
$data[] = array('place' => $place, 'name' => $name, 'score' => $score);
|
||||
}
|
||||
$all_cat_highscores = $db->query('SELECT COUNT(*) FROM "Highscores" WHERE "Categories_ID" = $1', array($cid))
|
||||
['data'][0]['count'];
|
||||
$all_users = $db->query('SELECT "ID" FROM "Users"')['data'];
|
||||
foreach($all_users as $user) {
|
||||
//if($db->query('SELECT exists FROM "Highscores" WHERE "Users_ID" = $1 AND "Categories_ID" = $2',
|
||||
// array($user['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
$response = Database::create_response($data, $error);
|
||||
|
||||
Reference in New Issue
Block a user