|
@@ -1,5 +1,4 @@
|
|
|
<?php
|
|
<?php
|
|
|
-/* Games.php */
|
|
|
|
|
$hostname = 'localhost';
|
|
$hostname = 'localhost';
|
|
|
$username = 'narKampen';
|
|
$username = 'narKampen';
|
|
|
$pass = 'narKampenPassword';
|
|
$pass = 'narKampenPassword';
|
|
@@ -35,7 +34,7 @@
|
|
|
}
|
|
}
|
|
|
} else if ($callFunction === "PlayerQuestions") {
|
|
} else if ($callFunction === "PlayerQuestions") {
|
|
|
$userName = $conn->real_escape_string($_POST['userName']);
|
|
$userName = $conn->real_escape_string($_POST['userName']);
|
|
|
- $sql = "SELECT question, answer, categoryId as category, r,g,b,a FROM questions
|
|
|
|
|
|
|
+ $sql = "SELECT questions.id as id, question, answer, categoryId as category, r,g,b,a FROM questions
|
|
|
INNER JOIN questionToCategory on questions.id = questionToCategory.questionId
|
|
INNER JOIN questionToCategory on questions.id = questionToCategory.questionId
|
|
|
INNER JOIN category ON category.id = questionToCategory.categoryId
|
|
INNER JOIN category ON category.id = questionToCategory.categoryId
|
|
|
WHERE questions.id IN
|
|
WHERE questions.id IN
|
|
@@ -44,6 +43,7 @@
|
|
|
gameId = $gameId AND playerName = '$userName') ORDER BY answer ASC";
|
|
gameId = $gameId AND playerName = '$userName') ORDER BY answer ASC";
|
|
|
$result = $conn->query($sql);
|
|
$result = $conn->query($sql);
|
|
|
$returnArray = array();
|
|
$returnArray = array();
|
|
|
|
|
+ $i = 0;
|
|
|
while ($data = $result->fetch_assoc()) {
|
|
while ($data = $result->fetch_assoc()) {
|
|
|
foreach ($data as $key => $value) {
|
|
foreach ($data as $key => $value) {
|
|
|
$returnArray[$i][$key] = $value;
|
|
$returnArray[$i][$key] = $value;
|