T1703271557
This commit is contained in:
@@ -10,4 +10,5 @@
|
||||
11102 - User name already exists
|
||||
|
||||
= start.php =
|
||||
12101 - More questions wanted then existing
|
||||
12101 - 0 questions wanted, no game without a question!
|
||||
12102 - More questions wanted then existing
|
||||
@@ -51,12 +51,12 @@ class Database
|
||||
case 11102:
|
||||
return 'User name already exists. Please pick a different name.';
|
||||
case 12101:
|
||||
return 'A game without a question is not possible. Please select new game length.';
|
||||
case 12102:
|
||||
return 'We only have '.$values[0].' questions. Please select new game length.';
|
||||
default:
|
||||
return 'An unknown error occurred.';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,9 +14,11 @@
|
||||
$length = ($_GET['length'] && gettype(+$_GET['length']) == 'integer') ? +$_GET['length'] : 10;
|
||||
$database = new Database();
|
||||
$questions_count = $database->query('SELECT COUNT(*) FROM "Questions"')['data'][0]['count'];
|
||||
|
||||
if($length > $questions_count) {
|
||||
if($length = 0) {
|
||||
$error = 12101;
|
||||
}
|
||||
if($length > $questions_count) {
|
||||
$error = 12102;
|
||||
$values = array($questions_count);
|
||||
}
|
||||
$response = Database::create_response($data, $error, $values);
|
||||
|
||||
Reference in New Issue
Block a user