Anyone know or have done it? Anyone know where I can learn about it if it is possible or a script to buy? ex. "Bills Diner" within 5 miles of zip 90210 can you create the full text index for the zip and diner name and then add Boolean search to something like this... $query = "SELECT *.dinerTable FROM zipTable, dinerTable WHERE (POW((69.1*(lon-\"$lon\") *cos($lat/57.3)),\"2\") + POW((69.1*(lat-\"$lat\")),\"2\")) < ($radius*$radius) AND zip.dinerTable = zip.zipTable"; Code (markup): Unfortunately for me I have no clue on how to do it Any help would be great. Thanks! -J
ohh - it is possible - I do it on my site in the Nearby Cities portion. http://www.golfscramblesearch.com/city/22875/milwaukee/ I have the longitude and latitude of each city - and calculate in miles the difference from the original point. http://www.zipcodeworld.com/samples/distance.php.html
Yes, quite possible. I'd do it in PHP rather than trying to select out like that though. In fact thats exactly how I did it on the locator system at http://www.comfortkeepers.com/.
im working on something simular but could do with some help; I have two functions which work separately perfectly as two separate forms The first; (as no one will know what lattitude and longitude their zip code is) changes their zip code into two coordinates (longitute and latitude). I have a second function performs the search using lattitude and longitude to find stores that are within a certain area. Both work great but I can't work out how to join the two functions into one . Function one function getCoords($zip) { echo '<h2>stores</h2><p>you searched for '.$zip.'</p>'; $db_conn = db_connect(); // database connection // turn long and lat into zipcode $query = "SELECT latitude, longitude FROM zipcodes WHERE '".$zip."' = zip"; } PHP: Function two $query = "SELECT store_id, store_name, store_address, store_zipcode, 3963 * acos(cos(radians(90-latitude ))*cos(radians(90-'".$latitude."'))+sin(radians(90-latitude )) * sin(radians(90-'".$latitude."')) *cos(radians(longitude- '".$longitude."')) ) AS distance FROM stores, zipcodes WHERE stores.store_zipcode = zipcodes.zip HAVING (distance < '".$area."') ORDER BY distance asc"; } PHP:
jim jam, maybe you should make a separate thread. The problem is only related to a zipcode search and you may have more response post separately under its own title.