CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
$db_handle = new DBController();
$select=$db_handle-> runQuery("SELECT * FROM ((employee
INNER JOIN department ON employee.department_id = department.department_id)
INNER JOIN designation ON employee.designation_id = designation.designation_id)
");
$db_handle = new DBController();
$selectnum=$db_handle-> numRows("SELECT * FROM ((employee
INNER JOIN department ON employee.department_id = department.department_id)
INNER JOIN designation ON employee.designation_id = designation.designation_id)
");
$last_row = $selectnum - 1;
if($selectnum >= 1){
echo '{"status": "1",
"data":[';
$i =1;
foreach($select as $resulth){
$employee_id = $resulth['employee_id'];
$photo = $resulth['photo'];
$employee_code = $resulth['employee_code'];
$first_name = $resulth['first_name'];
$last_name = $resulth['last_name'];
$department_name= $resulth['department_name'];
$designation_name= $resulth['designation_name'];
$employee_id_to_date = $resulth['employee_id_to_date'];
$mobile_no = $resulth['mobile_no'];
$emp_is_active = $resulth['emp_is_active'];
echo'
{
"employee_id":"'.$employee_id.'",
"photo":"'.$photo.'",
"employee_code":"'.$employee_code.'",
"first_name":"'.$first_name.'",
"last_name":"'.$last_name.'",
"department_name":"'.$department_name.'",
"designation_name":"'.$designation_name.'",
"employee_id_to_date":"'.$employee_id_to_date.'",
"mobile_no":"'.$mobile_no.'",
"emp_is_active":"'.$emp_is_active.'"
}';
if($i <= $last_row){
echo ',';
}
$i++;
}
echo'
]}';
}else{
echo '{"status": "0",
"message":"Page Not found"
}';
}
?>