Created
May 20, 2017 10:01
-
-
Save naneri/019ec67bffb1ebcf66688593e3c64024 to your computer and use it in GitHub Desktop.
$fLat is the searchers latitude and $fLon the searchers longitude.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
`id`, | |
`name` | |
FROM | |
`stations` | |
WHERE | |
ACOS( SIN( RADIANS( `latitude` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `latitude` ) ) | |
* COS( RADIANS( $fLat )) * COS( RADIANS( `longitude` ) - RADIANS( $fLon )) ) * 6380 < 10 | |
ORDER BY | |
`distance` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment