title: Display multiple locations on Google Map v3 using PHP MYSQL WHILE LOOP
body: <p>I have this code that was once working but now is not. It is for displaying multiple locations on a map using Google maps version 3, by getting the locations from a table in the database, and looping through them using a PHP WHILE loop. Only one location is being displayed. The code is as below:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      var map ;
      function initialize() {
          var latlng = new google.maps.LatLng(53.933056, 9.503611);
          var myOptions = {
            zoom: 10,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
          };
          map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
          &lt;?
              $query = mysql_query("SELECT 
                  markers.id,
                  markers.place,
                  markers.address,
                  markers.lat,
                  markers.lng,
                  markers.description,
                  markers.type,
                  images.id,
                  images.thumb_path,
                  images.main 
                  FROM 
                  markers,images 
                  WHERE 
                  markers.type = '".$type."' 
                  AND markers.id = images.id 
                  AND images.main = 1
                  ");
              $numRows = mysql_num_rows($query);
              if($numRows &gt; 0){
                  while($row = mysql_fetch_assoc($query)){
          ?&gt;
          var contentString = '&lt;div id="content"&gt;'+
          '&lt;img src="&lt;?=$row['thumb_path'];?&gt;" width="100" height="100" hspace="2" align="left" /&gt;'+
          '&lt;h4&gt;&lt;?=$row['place'];?&gt;&lt;/h4&gt;&lt;p&gt;&lt;?=$row['address'];?&gt;&lt;/p&gt;'+
          '&lt;p align="right"&gt;&lt;a href="thedetails.php?id=&lt;?=$row['id'];?&gt;&amp;lat=&lt;?=$row['lat'];?&gt;&amp;lng=&lt;?=$row['lng'];?&gt;&amp;type=&lt;?=$type;?&gt;"&gt;More Details&lt;/a&gt;'+
          '&lt;/div&gt;';
          var marker = add_marker(&lt;?=$row['lat'];?&gt;, &lt;?=$row['lng'];?&gt;,"&lt;?=strtoupper($row['place']);?&gt;",contentString);
          marker.setMap(map);
                  &lt;? } ?&gt;
              &lt;? } ?&gt;
      }
  
      function add_marker(lat,lng,title,box_html) {
  
          var infowindow = new google.maps.InfoWindow({
              content: box_html
          });
  
          var marker = new google.maps.Marker({
                position: new google.maps.LatLng(lat,lng),
                map: map,
                title: title
          });
  
          google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
          });  
  
          return marker;
      }
  </code></pre>
  
  <p>Kindly assist.</p>