49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
$query="";
|
|
$id = $_REQUEST['id'];
|
|
error_log($id);
|
|
|
|
// $successfull_delete = false;
|
|
if(!empty($_REQUEST['id'])){
|
|
|
|
$get_data = "SELECT * FROM `checkup_form_temp` WHERE `checkup_type_id`='$id';";
|
|
$get_data_res = mysqli_query($conn, $get_data);
|
|
if($get_data_res->num_rows > 0){
|
|
while($get_data_row = mysqli_fetch_assoc($get_data_res)){
|
|
$emp_id = $get_data_row['emp_id'];
|
|
$checkup_id = $get_data_row['checkup_id'];
|
|
|
|
//DELETE CHECKUP FORM KEY VALUE
|
|
$delete_key_value = "DELETE FROM `checkup_form_key_value_temp` WHERE `checkup_form_id`='$checkup_id';";
|
|
if (!$result = @mysqli_query($conn,$delete_key_value)) {
|
|
exit(mysqli_error($conn));
|
|
echo json_encode("error");
|
|
}
|
|
|
|
//DELETE PATIENT MASTER
|
|
$get_patient = "SELECT * FROM `patient_master_temp` WHERE `id` = '$emp_id';";
|
|
$get_patient_res = mysqli_query($conn, $get_patient);
|
|
if ($get_patient_res->num_rows > 0) {
|
|
$delete_patient = "DELETE FROM `patient_master_temp` WHERE `id`='$emp_id';";
|
|
|
|
if (!$result1 = @mysqli_query($conn,$delete_patient)) {
|
|
exit(mysqli_error($conn));
|
|
echo json_encode("error");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//DELETE CHECKUP FORM
|
|
$delete_checkup_form = "DELETE FROM `checkup_form_temp` WHERE `checkup_type_id` = '$id';";
|
|
if (!$result1 = @mysqli_query($conn,$delete_checkup_form)) {
|
|
exit(mysqli_error($conn));
|
|
echo json_encode("error");
|
|
}
|
|
|
|
echo json_encode("success");
|
|
}
|
|
|
|
}
|