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

if ( !isset($_REQUEST['term']) )
    exit;
$rs = mysql_query('select * from  view_app_sorlist where app_name like "'. mysql_real_escape_string($_REQUEST['term']) .'%" or app_id like "'. mysql_real_escape_string($_REQUEST['term']) .'%" order by 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" width="10%">Id</td><td style="background:#336666" width="25%">Name</td><td style="background:#336666" width="65%">Job Title</td></tr></table> ' ,'value' => ''
           
        ); 
			
    while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) )
    {
	$index=$row['id'];
    $data[] = array(
            'label' =>'<table border="0" cellpadding="2" cellspacing="1"  style="width:100%"><tr><td width="10%">'. $row['app_id'] .'</td><td width="25%">'. $row['app_name'] .'</td><td width="65%">'. $row['job_title_name'] .'</td></tr></table> ' ,
            'id' => $index,
			'value' => $row['app_name'],
			'jb_title' => $row['job_title_name'],
			'app_id' => $row['app_id'],
			'job_title_id' => $row['job_title_id']
        );
    }
	
}

echo json_encode($data);
flush();

?>