i'm using suggestive search in my site but somehow its not workign.i have a table named as customers :
id customername location
1 ram delhi
2 monty new delhi
3 sandeep noida
now i want to auto-search in this table for name and location so here is my code for that:
<?php
include("config.php");
$term=$_GET["term"];
$query=mysql_query("SELECT * FROM customers where customername like '%".$term."%' or location like '%".$term."%'");
$json=array();
while($customer=mysql_fetch_array($query)){
$json[]=array(
'value'=> $customer["customername "],
'label'=>$customer["customername "]." - ".$customer["id"],
'value'=> $customer["location"],
'label'=>$customer["location"]." - ".$customer["location"],
);
}
echo json_encode($json);
?>
with the help of this query i'm not able to auto search for customername and location both at one time means if i want to search customer name then it should give customer name and if i put location in search field it should give location.currently its giving me the last value as mentioned in above code this time its only giving me location.