<?php include "configuration.inc.php";?>
<?php

if ( !isset($_REQUEST['term']) )
    exit;
$rs = mysql_query('select * from  view_trn_attendent_details where name like "%'. $_REQUEST['term'] .'%" or emp_id like "%'. $_REQUEST['term'] .'%"  order by emp_id asc');

$data = array();

if ( $rs && mysql_num_rows($rs) )
{

$data[] = array(
            'label' =>'<table border="0" cellpadding="2" cellspacing="1" style="width:100%">
			<tr style="color:#fff;"><td style="background:#336666">Id</td><td style="background:#336666">Employee Name</td></tr></table> ' ,'value' => ''
           
        ); 
			
    while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) )
    {
	$index=$row['emp_id'];
    $data[] = array(
            'label' =>'<table border="0" cellpadding="2" cellspacing="1"  style="width:100%"><tr><td>'. $row['emp_id'] .'</td><td>'. $row['name'] .'</td></tr></table> ' ,
            'id' => $index,
			'value' => $row['name'],
			'trn_atndnt_mas_id'=>$row['trn_atndnt_mas_id']		
        );
    }
	
}

echo json_encode($data);
flush();

?>