I'm trying to search multiple fields (zc_city, zc_zip and zc_state), matching against a single value input by the user. The three columns should be included in the results. Here's what I have now:
$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\n";
}
The table has the structure:
CREATE TABLE search_zipcodes (
zc_zip VARCHAR(5),
zc_lat FLOAT,
zc_lon FLOAT,
zc_city VARCHAR(80),
zc_state CHAR(2)
);