GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Data results so slow in autocomplete  XML
Forum Index -> General
Author Message
Tab



Joined: 13/08/2010 19:44:27
Messages: 23
Offline

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.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team