function delete($id) { $tutor = new Tutor(); $tutor->setTutorId($id); $tutor->delete(); header("location: ../view/index.php"); }
} break; } } //If validated and not empty submit it to database if (count($errorArr) < 1) { $pictureDelParam = true; if ($tutorImage != '' && file_exists(MEDIA_FILES_PATH . "tutor/" . $tutorImage)) { if (unlink(MEDIA_FILES_PATH . "tutor/" . $tutorImage)) { $pictureDelParam = true; } else { $pictureDelParam = false; } } if ($pictureDelParam == true) { echo $tutorObj->delete(); } else { $json = array("status" => 0, "msg" => $errorArr); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } } else { //Else show error messages $json = array("status" => 0, "msg" => $errorArr); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); }