Jump to content

php syntax


sudhakararaog

Recommended Posts

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

 

 

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

 

 

<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

 

Link to comment
https://forums.phpfreaks.com/topic/213379-php-syntax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.