This commit is contained in:
2019-07-04 09:40:54 +02:00
parent 136be864ec
commit 9764032956

View File

@@ -19,8 +19,9 @@ END;
$db = new Database(); $db = new Database();
$questions = $db->getQuestions(); $questions = $db->getQuestions();
//
//This is ugly but does the job (I'm used to the laravel collections) //This will convert the array into objects for easier access.
//The conversion is ugly but does the job (I'm used to the laravel collections)
$questionsobj = json_decode(json_encode($questions), false); $questionsobj = json_decode(json_encode($questions), false);
foreach($questionsobj as $question) { foreach($questionsobj as $question) {
@@ -36,9 +37,13 @@ foreach($questionsobj as $question) {
$color = ($question->solution == 2) ? "background-color: green" : "background-color: red"; $color = ($question->solution == 2) ? "background-color: green" : "background-color: red";
echo("<td style='$color'>$question->answer2</td>"); echo("<td style='$color'>$question->answer2</td>");
echo("<td>$question->solution</td>"); echo <<<END
echo("<td></td>"); <td><form action="questions-edit.php" method="get"><button name="id" value="$question->id">Bearbeiten</button></form></td>
echo("</tr>");
<td><form action="questions-delete.php" method="post"><button name="id" value="$question->id">Löschen</button></form></td>
</tr>
END;
} }