From bcaa397e7db3cb9867ad430d430db3e00117b62a Mon Sep 17 00:00:00 2001 From: structix Date: Thu, 11 Jul 2019 13:44:35 +0200 Subject: [PATCH] Update --- uebung10/api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uebung10/api.php b/uebung10/api.php index f76b979..2df57c3 100644 --- a/uebung10/api.php +++ b/uebung10/api.php @@ -12,6 +12,10 @@ if (isset($_GET['n'])) { } $questions = $db->getQuestions($n); -$questionsobj = json_encode($questions); +$answers[] = array($questions['answer0'], $questions['answer1'], $questions['answer2']); + +$jsonarray[] = array("id" => $questions['id'], "answers" => $answers, "solution" => $questions['solution']); + +$questionsobj = json_encode($jsonarray); echo($questionsobj); ?>