<?php require_once('../auth/auth.php');
if (isset($_GET["term"])) {
$term = $_GET["term"];
$cus_r= mysqli_query($conn,"SELECT c_id,c_name,c_gsm,c_address FROM c_customer WHERE coid='$coid' AND bid='$bid' AND brid='$brid' AND (c_name LIKE '%$term%' || c_gsm LIKE '%$term%') ORDER BY c_id ASC LIMIT 10") or die (mysqli_error($conn));
$c_cus = [];
while ($rowc= mysqli_fetch_assoc($cus_r)) {
$c_cus[]= ['value'=>$rowc['c_gsm'] , 'label'=>$rowc['c_name']." ".$rowc['c_gsm'],'name'=>$rowc['c_name'],'addr'=>$rowc['c_address']];
}
echo json_encode( $c_cus );
}
?>