ESH/select_client_list.php

36 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php
error_reporting(E_ERROR | E_PARSE);
include ('includes/config/config.php');
include('log_entry.php');
include('includes/functions.php');
$id = $_REQUEST['id'];
error_log("got_id".$id);
// $sql="select client_name from client_master a left join patient_master b on a.client_id = b.client_id where b.id = '$id'";
$user_id=getFieldFromTable('user_id','tbl_users','patient_id',$id);
$sql='';
if(isset($user_id))
{
$sql="SELECT a.*,b.role_name,c.client_name, e.patient_name FROM tbl_users a left join role_master b on a.role_id=b.role_id left join patient_master e on a.patient_id=e.id left join client_master c on e.client_id = c.client_id where a.patient_id=".$id;
}
else
{
$sql="select client_name from client_master a left join patient_master b on a.client_id = b.client_id where b.id = '$id'";
}
error_log($sql);
$data=array();
$results=@mysqli_query($conn,$sql);
while($row = @mysqli_fetch_array ( $results )){
$data=$row;
}
echo json_encode($data);
?>