Trying to make this tutorial work on SS http://code.google.com/apis/maps/articles/phpsqlsearch.html
Here is my current code;
<code>function markers() {
// Get parameters from URL
$center_lat = $_GET["Lat"];
$center_lng = $_GET["Lng"];
$radius = $_GET["radius"];
$Markers = DB::query("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 Marker 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));
//$Markers = DataObject::get('Marker');
return $this
->customise(array("Markers" => $Markers))
->renderWith("MarkerXML");
}
</code>
as you can see i have a function that generates a xml file with all the markers that have been set on the backend admin.
The file works great when i do a DataObject:get on the Marker class.
However, this only brings up all markers.
what i want is for the markers to come up based on the lng and lang using the formula above.
The current code gives this error:
[Notice] Undefined index: Lat
any help or direction on this would be really appreciated ... regards,
Miguel