title: How to add google Map marker from SQL database
body: <p>I have a google map and I would like to add a new marker on it for each element I add on my database (with it latitude and longitude).
  This is what I have done that isn't working.
  Thanks for helping.</p>
  
  <pre><code>&lt;?php
      $reponse = $bdd-&gt;query('SELECT * FROM zdou ORDER BY id ');
      while ($donnees = $reponse-&gt;fetch()){
  
      ?&gt;
          &lt;p&gt;
              &lt;strong&gt;latitude&lt;/strong&gt; : &lt;?php echo $donnees['latitude']; ?&gt;&lt;br/&gt;
              &lt;strong&gt;longitude&lt;/strong&gt; : &lt;?php echo $donnees['longitude']; ?&gt;&lt;br/&gt;
          &lt;/p&gt;
          &lt;?php
              $latitude = $donnees['latitude'];
              $longitude = $donnees['longitude'];
          ?&gt;
          &lt;script&gt;
              latitude = &lt;?php echo $latitude ?&gt;;
              longitude = &lt;?php echo $longitude ?&gt;;
              marker = new google.maps.LatLng(latitude, longitude);
              var placerMarker = new google.maps.Marker({position:marker,map:map,title:"Zdou"});
          &lt;/script&gt;
          &lt;?php
      }
      $reponse-&gt;closeCursor();
          ?&gt;
  </code></pre>
  
  <p>And I have created the map with the user position like this :</p>
  
  <pre><code>function showPosition(position) {
              lat = position.coords.latitude;
              lon = position.coords.longitude;
              latlon = new google.maps.LatLng(lat, lon)
              mapholder = document.getElementById('mapholder')
              mapholder.style.height = '250px';
              mapholder.style.width = '500px';
  
              var myOptions = {
              center:latlon,zoom:12,
              mapTypeId:google.maps.MapTypeId.ROADMAP,
              mapTypeControl:false,
              navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}
              }
              var map = new google.maps.Map(document.getElementById("mapholder"), myOptions);
              var myPos = new google.maps.Marker({position:latlon,map:map,title:"You are here!"});
  
          }
  </code></pre>
  
  <p><strong>EDIT :</strong>
  I created a variable that increment each time it enter into the "script" in the while loop, and then display that variable.
  Guess what, the variable is undefined, so the script in the loop isn't read.
  Still need some help pls !</p>