T201704031307
This commit is contained in:
11
.idea/dataSources.xml
generated
Normal file
11
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="PostgreSQL - CSDB@lamp.wlan.hwr-berlin.de" uuid="6b4ffb0f-12f7-4d00-a382-ec0cee24f738">
|
||||||
|
<driver-ref>postgresql</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:postgresql://lamp.wlan.hwr-berlin.de:5432/CSDB</jdbc-url>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/sqldialects.xml
generated
Normal file
6
.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$" dialect="PostgreSQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -35,6 +35,14 @@ class Question
|
|||||||
$this->category = $c;
|
$this->category = $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function get_next_question($db, $uid) {
|
||||||
|
$qid = $db->query('SELECT "Questions_ID" FROM "GamesQuestions" WHERE "Games_ID" = $1 LIMIT 1', array($uid))['data'][0]['ID'];
|
||||||
|
$question = new Question($db, $qid);
|
||||||
|
$db->query('DELETE FROM "GamesQuestions" WHERE "Games_ID" = $1 AND "Questions_ID" = $2', array($uid, $qid));
|
||||||
|
$question_object = $question->get_question_object();
|
||||||
|
return $question_object;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the question message for API.
|
// Create the question message for API.
|
||||||
function get_question_object() {
|
function get_question_object() {
|
||||||
$question_object = array(
|
$question_object = array(
|
||||||
|
|||||||
@@ -45,6 +45,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$next_question = Question::get_next_question($db, $uid);
|
||||||
|
$data = array('next' => $next_question);
|
||||||
|
|
||||||
$response = Database::create_response($data, $error, $values);
|
$response = Database::create_response($data, $error, $values);
|
||||||
print $response;
|
print_r($response);
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user