我是否错过了加快此选择查询的任何技巧?查询在用户输入时获取位置数据,并自动填充。
$q = mysqli_real_escape_string(strtolower($_GET["q"]));
if (!$q) return;
$sql = "SELECT us_city AS city, us_abv AS state, us_zip AS zip
FROM search_us
WHERE us_zip LIKE '$q%' OR us_city
LIKE '$q%' GROUP BY us_abv, us_city, us_zip LIMIT 15";
$places = mysqli_query($sql);
while($place = mysqli_fetch_array($places)) {
echo "$place[city], $place[state], $place[zip]\n";
}