I have 2 tables. One with a list of businesses and their addresses the other with a list of zip codes and their longitude and latitude. I have a form that accepts a zip code and a number of miles to check radius.
all the radius stuff works from a script i found online. what I need is to echo the entries of businesses that are within the radius.
So far i have 2 queries. one gets all entries zip codes inside the db the other get all zipcodes within the range i put in the form
i'm using array_intersect to find the matching ones. my problem is it only returns the first entry found. I'm SURE i need a while loop to do this but i have no idea how to do it.
code snippet:
$insideRadius = array_intersect($data, $zipArray);
The $data is all the zip codes from the business table. the $zip array is all the zip codes within range.
JOIN
them on zip code ?