Fragen anzeigen
Frage |
Antwort0 |
Antwort1 |
Antwort2 |
|
|
END;
$db = new Database();
$questions = $db->getQuestions();
//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);
foreach($questionsobj as $question) {
echo("");
echo("$question->question | ");
$color = ($question->solution == 0) ? "background-color: green" : "background-color: red";
echo("$question->answer0 | ");
$color = ($question->solution == 1) ? "background-color: green" : "background-color: red";
echo("$question->answer1 | ");
$color = ($question->solution == 2) ? "background-color: green" : "background-color: red";
echo("$question->answer2 | ");
echo <<
|
END;
}
echo <<
Frage hinzufügen
END;
?>