I m试图搜索多个领域(zc_city, zc_zip和zc_state),与用户单一价值投入相匹配。 这三栏应列入结果。 这里我要说的是:
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "SELECT DISTINCT zc_city AS zcity FROM search_zipcodes WHERE zc_city LIKE $q% ";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$zcity = $rs[ zcity ];
echo "$zcity
";
}
该表的结构如下:
CREATE TABLE search_zipcodes (
zc_zip VARCHAR(5),
zc_lat FLOAT,
zc_lon FLOAT,
zc_city VARCHAR(80),
zc_state CHAR(2)
);