I'm trying to query with a php list, I'm not even sure if it is possible but hopefully you can give some advice/assistance on the matter.
I get a zip list from another function that contains a lot of zip codes, and I want to use that list to narrow down a search.
Notice: Array to string conversion in C:\wamp\www
This is where I get the array to string error
. JOIN zip_list zl ON r.zip_code IN ('$zip_list') "
I know it works perfectly with replacing $zip_list with ('2150','2165') for example but the list will be rather long so I can't just put $zip_list[$i].
I've tried some conversion with $trimZip and $test but it always yields the same error.
for($i=0; $i<count($zip_list); $i++){
array_push($trimZip, "'".$zip_list[$i]."',");
$i = $i+1;
}
for($i = 0; $i<count($trimZip); $i++){
$test[$i] = $trimZip[$i];
}
Is there a good way to do this or am I even looking at it the right way ? Better/easier angles are welcome too!
$zip_listis an array ? And you want the values of the array to be concatenated as a string ?implode(). Like$zip_list = implode(',', $zip_list);?