ESH/check_existing_exam.php
2024-10-23 18:28:06 +05:30

38 lines
830 B
PHP

<?php
include('includes/config/config.php');
include('log_entry.php');
$where_key = $_REQUEST['key'];
$patient = $_REQUEST['key_val'];
$query="SELECT b.patient_name,b.father_name,date(a.medical_entry_date) as date,a.task FROM `medical_examination` a LEFT JOIN patient_master b on a.patient_id=b.id WHERE patient_id=".$patient." AND medical_entry_date > now() - INTERVAL 30 day ORDER BY medical_entry_date DESC limit 1";
error_log("abcbcb: ".$query);
$result=mysqli_query($conn,$query);
$numrows=mysqli_num_rows($result);
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
$data = array();
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$data = $row;
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
echo json_encode($data);
?>