CasperSecurity
<?php
session_start();
include '../../../../web/connection/connection.php';
$employee_id = $_REQUEST['employee_id'];
if(isset($employee_id)){
$db_handle = new DBController();
$selecth=$db_handle-> runQuery("SELECT * FROM (((employee
INNER JOIN employee_type ON employee.employee_type_id = employee_type.employee_type_id)
INNER JOIN department ON employee.department_id = department.department_id)
INNER JOIN designation ON employee.designation_id = designation.designation_id)
WHERE employee.employee_id = '$employee_id'");
$db_handle = new DBController();
$selecthnum=$db_handle-> numRows("SELECT * FROM (((employee
INNER JOIN employee_type ON employee.employee_type_id = employee_type.employee_type_id)
INNER JOIN department ON employee.department_id = department.department_id)
INNER JOIN designation ON employee.designation_id = designation.designation_id)
WHERE employee.employee_id = '$employee_id'");
$last_row = $selecthnum - 1;
if($selecthnum >= 1){
echo '{"status": "1",
"data":[';
$i =1;
foreach($selecth as $resulth){
$employee_id = $resulth['employee_id'];
$employee_code = $resulth['employee_code'];
$employee_type = $resulth['employee_type'];
$first_name= $resulth['first_name'];
$last_name = $resulth['last_name'];
$address = $resulth['address'];
$mobile_no = $resulth['mobile_no'];
$mail_id = $resulth['mail_id'];
$father_name = $resulth['father_name'];
$father_mobil_no= $resulth['father_mobil_no'];
$dateofbirth = $resulth['dateofbirth'];
$joining_date = $resulth['joining_date'];
$pfno = $resulth['pfno'];
$esi_no = $resulth['esi_no'];
$department_name = $resulth['department_name'];
$designation_name= $resulth['designation_name'];
$education = $resulth['education'];
$institution = $resulth['institution'];
$pass_year = $resulth['pass_year'];
$marks= $resulth['marks'];
$photo = $resulth['photo'];
$signature = $resulth['signature'];
$employee_id_from_date = $resulth['employee_id_from_date'];
$employee_id_to_date = $resulth['employee_id_to_date'];
$emp_is_active = $resulth['emp_is_active'];
echo'
{
"employee_id":"'.$employee_id.'",
"employee_code":"'.$employee_code.'",
"employee_type":"'.$employee_type.'",
"first_name":"'.$first_name.'",
"last_name":"'.$last_name.'",
"address":"'.$address.'",
"mobile_no":"'.$mobile_no.'",
"mail_id":"'.$mail_id.'",
"father_name":"'.$father_name.'",
"father_mobil_no":"'.$father_mobil_no.'",
"dateofbirth":"'.$dateofbirth.'",
"joining_date":"'.$joining_date.'",
"pfno":"'.$pfno.'",
"esi_no":"'.$esi_no.'",
"department_name":"'.$department_name.'",
"designation_name":"'.$designation_name.'",
"education":"'.$education.'",
"institution":"'.$institution.'",
"pass_year":"'.$pass_year.'",
"marks":"'.$marks.'",
"photo":"'.$photo.'",
"signature":"'.$signature.'",
"employee_id_from_date":"'.$employee_id_from_date.'",
"employee_id_to_date":"'.$employee_id_to_date.'",
"emp_is_active":"'.$emp_is_active.'"
}';
if($i <= $last_row){
echo ',';
}
$i++;
}
echo'
]}';
}else{
echo '{"status": "0",
"message":"Page Not found"
}';
}
}
?>