SELECT DISTINCT multiple field search?
Posted
by Patrick
on Stack Overflow
See other posts from Stack Overflow
or by Patrick
Published on 2010-04-03T00:09:47Z
Indexed on
2010/04/03
0:13 UTC
Read the original article
Hit count: 133
I'm trying to search multiple fields zc_city and zc_zip for when user input and then return row results for zc_city zc_state and zc_zip
$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"; }
© Stack Overflow or respective owner