ESH/select_employee_health_index.php

36 lines
846 B
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?php
include('includes/config/config.php');
error_reporting(E_ERROR | E_PARSE);
$Id = $_REQUEST['emp_id'];
$query = "select health_score,checkup_date from checkup_form where emp_id ='".$Id."' order by checkup_date asc limit 6";
// echo $query;
if (!$result = @mysqli_query($conn,$query )) {
exit(mysqli_error($conn));
}
$data = array();
$x=0;
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
// $data[$x] = $row;
//$data[]=$row;
//$x++;
//$data[$x]=$row;
$data[$x]['health_score']=$row['health_score'];
$data[$x]['checkup_date']=date_format(date_create($row['checkup_date']),"d-M-Y");
$x++;
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
echo json_encode($data);
?>