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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.