Hello,
I tried to use jQuery autocomplete with 'geonames' and 'admin1_codes' tables imported in my mysql DB.
I simply made a mysql query in this way:
Code:
public function printResult()
{
$sql = "SELECT geoname_id,name,admin1_code,country_code FROM geonames WHERE name LIKE '$this->term%' ORDER BY name ASC LIMIT 20 ";
$res = mysql_query($sql, $this->conn) or die(mysql_error());
$return = array();
$arr = array();
while($row = mysql_fetch_array($res))
{
$arr['id'] = $row['geoname_id'];
$arr['value'] = $row['name'].
array_push($return, $arr);
}
echo json_encode($return);
}
but it appears very very slow to show results.
Have you a better solution?
Thanks.