php - How to Find Zip codes by Zip and Distance -


please, me. need find zip codes zip , distance miles. know few ways, how to. can create table location, zip_code, lat, lng , use mysql find can takes many time because,

1 - find lat, lng location.zip_code = xxxx

2 - find mysql -

select  `id`,  `zip_code`,  ( 6373 * acos( cos( radians( :lat ) ) * cos( radians( `lat` ) ) * cos( radians( `long` ) - radians( :long ) ) + sin(radians(:lat)) * sin(radians(`lat`)) ) ) `distance`  `location`  having `distance` < :distance  order `distance` limit 25 

return $zip_codes 3 - find sql

select * **** zip in ($zip_codes)  

maybe know how optimize case?


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -