
PK 
<?php
session_start();
require_once 'common/common.php';
require_once 'common/secure.php';
include "connexion.php";
if ( !isset($_REQUEST['term']) )
exit;
$q="SELECT * From clients where subname like '". mysql_real_escape_string($_REQUEST['term']) ."%' and subname<>'.' AND subname<>'' AND subname<>'..' ORDER BY subname ASC limit 0,10";
//$q='select headid, headname, headaddress from head where headname like "'. mysql_real_escape_string($_REQUEST['term']) .'%" order by headname asc limit 0,10';
$rs = mysql_query($q) or die(mysql_error());
$data = array();
if ( $rs && mysql_num_rows($rs) ){
while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ){
$headid = strip_tags($row['subid']);
$headname = strip_tags($row['subname']);
$headaddress = strip_tags($row['subaddress']);
$data[] = array(
'label' => '→ '. $headname .', '. $headaddress,
'value' => $headid.', '. $headname.', '. $headaddress ,
);
}
}
echo json_encode($data);
flush();
?>


PK 99