ESH/select_patient.php

49 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php
include('includes/config/config.php');
include_once('log_entry.php');
$where_key = $_REQUEST['key'];
$where_val = $_REQUEST['key_val'];
if($where_key=='id'){
$where_cls =" where id = '".$where_val."' ";
}else if($where_key=='aadhar'){
$where_cls =" where aadhar_no='".$where_val."' ";
}else if($where_key=='ecode'){
$where_cls =" where emp_code='".$where_val."' ";
} else if($where_key=='passport'){
$where_cls =" where passport='".$where_val."' ";
}else{
exit(mysqli_error($conn));
}
$query = "select * from view_patient_master ".$where_cls;
error_log("Patient_Search:".$query);
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
$data = array();
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
//extract($row);
$data = $row;
$data['emp_photo']=base64_encode($row['emp_photo']);
$data['emp_sign']=base64_encode($row['emp_sign']);
$data['doj']=date_format(date_create($row['doj']),"d-M-Y ");
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
// echo $data;
echo json_encode($data);
?>