title: Array multiple points in google maps with sql & php?
body: <p>I a newbie in PHP. The code above works fine, but only with one marker. If I use top 1 to search one point it's ok.</p>
  
  <p>When I change the top nubmer like 10 still shows one or last marker. How can I show multiple markers? 
  I don't want to use json.
  I think there's something like var array. 
  Thank you </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
    &lt;link rel="stylesheet" type="text/css" media="screen" href="css.css"&gt;
      &lt;meta name="viewport"
          content="initial-scale=1.0, user-scalable=no" /&gt;
      &lt;style type="text/css"&gt;
        html { height: 100% }
        body { height: 100%; margin: 0; padding: 0; color: white }
        #map-canvas { height: 100% }
      &lt;/style&gt;
      &lt;script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=
            &lt;?php echo $apikey; ?&gt;&amp;sensor=false"&gt;
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        function initialize() {
          &lt;?php
      $con =  mssql_connect(DB_HOST2, DB_USER2, DB_PASS2,DB_NAME2)
      or die('Something went wrong while connecting to MSSQ');
      mssql_select_db("MDTcan", $con);
      $query = ("select top 10 Cabno, lat, long, ttime
          from gps_history
          where ttime = (select min(ttime) from gps_history as f where f.Cabno = gps_history.Cabno)
          order by cabno"); 
      
   
      
  
      $result = mssql_query($query);
  
         while($row = mssql_fetch_assoc($result))
      {
      
       echo ' var mapOptions = {
          center: new google.maps.LatLng(  
             '. $row['lat'].', '.$row['long'].'),
          zoom: 13
        };
        var map = new google.maps.Map(document.getElementById("map-canvas"),
         mapOptions);
         var myLatlng1 = new google.maps.LatLng('.
             $row['lat'].', '.$row['long'].'); 
             
         var marker = new google.maps.Marker({ 
          position: myLatlng1, 
          map: map, 
          animation: google.maps.Animation.DROP,
          title:"'.$row['Cabno'].','.$row['Hora'].'"
           });';
          }
     ?&gt;
         }
        google.maps.event.addDomListener(window, 'load', initialize);
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;center&gt;
   &lt;/center&gt;
      &lt;div id="map-canvas"/&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>