i would like to display statistics information and show this on a map with multiple markers
i have initially created for a single marker the example is at
http://www.sudhakargolakaram.co.in/files/stats.php
for this i have written the following in the php file
PHP Code:
echo (' <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script src="maps api key"></script> <script src="jquery.googlemaps1.01.js"></script> ');
$lat="-36.847385"; $lon="174.765735";
echo(' <script type="text/javascript"> $(document).ready(function() { $("#map_canvas").googleMaps({ markers: { latitude: '); echo $lat; echo(', longitude: '); echo $lon; echo(' } }); }); </script> '); ?>
this is working fine
however i would like to get the values of the latitude and longitude values from mysql using select query and pass the values of latitude and longitude to the javascript code using a while loop
the code to display multiple markers is
HTML Code:
<script type="text/javascript">
$(document).ready(function() {
$('#map_canvas').googleMaps({
markers: [{
latitude: 37.4416,
longitude: -122.1516
},{
latitude: 37.4516,
longitude: -122.1616
},{
latitude: 37.4566,
longitude: -122.1666
}]
});
});
</script>
this multiple markers is quite different to single marker as this does not have },{ for the last marker
in terms of the syntax of the php code how can i write the php code so that i will get the output in the browser as mentioned above for multiple markers
thanks
Last edited by chrishirst; 09-14-2010 at 02:46 PM..
|