$data["error"] = 0; $data["message"] = "A new test was inserted in the database!"; echo json_encode($data); } else { $data["success"] = 0; $data["error"] = 1; $dat["message"] = "Something went wrong while inserting the test in the database!"; echo json_encode($data); } } } } else { if ($mode == 'deleteTest') { if (isset($_POST['test_id']) && $_POST['test_id'] != '') { $test_id = $_POST['test_id']; $success = $database->deleteTest($test_id); if ($success != false) { $data["success"] = 1; $data["error"] = 0; $data["message"] = "The test was deleted from the database!"; echo json_encode($data); } } else { $data["success"] = 0; $data["error"] = 1; $data["message"] = "Not enough parameters provided!"; echo json_encode($data); } } } }