Mark multiple locations on google map with google map api -


I want to add several locations to Google Maps. I have saved the long-term and latitude in the database, then I recover it from PHP and add the data to the JavaScript function. When I hardcode the places in JavaScript, it works fine but when I load the data with PHP it does not work. But when I check it with firebug, it shows that PHP values ​​have come to relevant places. The issue is that nothing is loading, with the following code I.

  & lt; script type = "text / javascript" & gt; Function initialize () {& lt ;? Php $ con = mysqli_connect ("HOST", "DBUSERNAME", "DBPASSWORD", "TABLE"); // Check connection if (mysqli_connect_errno ()) {echo "failed to connect to MySQL:". Mysqli_connect_error (); } $ Result = mysqli_query ($ con, "SELECT * FROM places"); ? & Gt; Var calculation = 0; Var my = new google.maps.LatLng (7.860661,80.674896); Var map option = {zoom: 8, center: my}   

Initialize my code function () {

  $ result = mysqli_query ($ con, "SELECT * FROM locations"); ? & Gt; // var count = 0; & Lt ;? Php $ count = 0 ;? & Gt; Var my = new google.maps.LatLng (7.860661,80.674896); Var mapOptions = {zoom: 8, center: my}   

} google.maps.event.addDomListener (window, 'load', start);

Your problem is here (information in your 'answer', not yet in your question): < / Late Long Constructor is expected to have two floating point numbers, not two strings. If this is

  new google.maps.LatLng (6.936 99279860 9 35)   

you will be fine to use these values ​​to float :

  finallatlang = new google.maps.LatLng (perfot (& lt ;? php echo $ row ['latitude'] ;; & gt;), parseFloat (& lt ;; php echo) $ Line ['long time'];; & gt;);    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -