1
radius query mysql
CGuild1.com > Tips & Tricks > radius query mysql

Radius Search with PHP and mySQL

This is a fairly quick Radius search done as long as you have the at and long for all locations.

SELECT *, (3959 * ACOS(COS(RADIANS('42.75')) * COS(RADIANS(lat)) * COS( RADIANS(`long`) - RADIANS('84.74')) + SIN(RADIANS('42.75')) * SIN(RADIANS(lat)))) AS distance FROM table_name WHERE zip != '' HAVING distance < 30 ORDER BY column_name DESC LIMIT 0, 50;

I am not exactly sure whom to give credit to for this snippet, but I am assuming it was either stackoverflow or zigtag.
©2024 CGuild1.com