Created
May 7, 2016 12:07
-
-
Save onocom/8dd313f86ae99eb75fd1637b74512aaf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//https://developers.google.com/maps/articles/phpsqlsearch_v3#outputting-xml-with-php | |
// Search the rows in the markers table | |
$query = sprintf("SELECT address, name, lat, lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20", | |
mysql_real_escape_string($center_lat), | |
mysql_real_escape_string($center_lng), | |
mysql_real_escape_string($center_lat), | |
mysql_real_escape_string($radius)); | |
$result = mysql_query($query); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment