<?php 
/**  * Creates fault detail data as JSON  */    
include_once 'db_functions.php';     
$db = new DB_Functions();  
$user_id=$_REQUEST[user_id];
$from_date=$_REQUEST[from_date];
$to_date=$_REQUEST[to_date];

$users1 = $db->getEng_attendance($user_id, $from_date, $to_date);  
$a = array();     
$b = array();   
$atten = array();
$sarray = array();
if ($users1!= false){
	         
while ($row = mysql_fetch_array($users1)) { 
$user = mysql_fetch_array(mysql_query("select username,uid from admin_users where username='$row[user_id]'"));  
$b["userid"] = $user[1];                    
$b["username"] = $user[0];
//$b["name"] = $asc[0].$asc["1"];

$atten= $row["attendence_date"];
$sarray=explode(" ",$atten);
$b["in_date_time"] = $row["in_datetime"];
$b["out_date_time"] = $row["out_datetime"];

$b["attendence_status_in"] = $row["status_in"];
$b["attendence_status_out"] = $row["status_out"];
//$b["city"] = $row["city"];
 // $b["location"] = $row["address_in"];    
array_push($a,$b);         
}    
	
echo json_encode($a);     
} 

?>