I am storing 5 digit zip codes selected by clients like this, in a table.
56510-56511-56514-56519-56525-56529-56536-56541-56546-56547-56548-56549-56550-56552-56553-56554-56560-56561-56562-56563-56574-56579-56580-56581
In my query I am first selecting this data and replacing the hyphen with a comma, like this.
$selectedzip[] = $row["selected_zip"];
$selectedzip1 = str_replace("-", "\",\"", $selectedzip);
$selectedzipstr = implode("','", $selectedzip1);
Then I am inserting this into a query using IN.
AND ZIP IN (\"".$selectedzipstr."\")
My question is that some of the Zip Codes in the table I am running the query on are 9 digits (56514-8476), My question is how do I only select by the first 5 digits, because when I run the query, it is not seeing these 9 digits ones as a valid part of the query. But they need to be, any help would be much appreciated.