Re: query question
| From: | Foong | Date: | Tue, 14 Jan 2003 18:04:48 +0000 |
| Subject: | Re: query question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131598@lists.php.net to get a copy of this message | ||
hope this help
// array of zip codes
$zips = array(...);
// can use implode() here if you want
foreach($zips as $zip) {
$zip_list = ",'".$zip."'";
}
// take away the first comma
$zip_list = substr( $zip_list, 1);
$sql = "SELECT stores FROM store_table WHERE zip_code IN('$zip_list')";
$hdl = mysql_query($hdl);
Foong
Kelly Meeks <info@rightangleinc.com> wrote in message
news:009c01c2bbf5$03496b00$6901a8c0@yourw92p4bhlzg...
I've got an array of values, that I need to query against a database to see
if any records have any of the values in the array - the array is a list of
zip codes, and the database contains a list of stores. Basically i need to
find what stores have zip codes in the array.
I know that mysql doesn't support subquerys - is there a workaround for this
kind of scenario?
TIA,
Kelly