$data["success"] = 0; $data["error"] = 1; $data["error_message"] = "Could not get the messages from the topic!"; } } else { $data["success"] = 0; $data["error"] = 1; $data["error_message"] = "Not enough parameters provided!"; echo json_encode($data); } } else { if ($mode == 'showAllTests') { if (isset($_GET['school_class']) && $_GET['school_class'] != '' && isset($_GET['school_year']) && $_GET['school_year'] != '') { $school_year = $_GET['school_year']; $school_class = $_GET['school_class']; $tests = $database->getTests($school_class, $school_year); if ($tests != false) { $data["success"] = 1; $data["error"] = 0; for ($i = 0; $i < count($tests); $i++) { $test = $tests[$i]; $data["tests"][$i + 1]["test_id"] = $test["test_id"]; $data["tests"][$i + 1]["test_class"] = $test["test_class"]; $data["tests"][$i + 1]["test_date"] = $test["test_date"]; $data["tests"][$i + 1]["school_year"] = $test["school_year"]; $data["tests"][$i + 1]["school_class"] = $test["school_class"]; } echo json_encode($data); } else { $data["success"] = 0; $data["error"] = 1;