Witam, potrzebuje pomocy w napisaniu kodu do google api maps, który wyświetli mi kilka lokalizacji jednocześnie. Lokalizacje wyświetlają się po pobieranych adresach (nie współrzędnych) z bazy danych mysql ( Nazwa bazy: google_map, tabela: map, Struktura - id, city, post_code, street, house_number, flat_number). Aktualnie mój skrypt wyświetla tylko jedną lokalizację.

****PHP

<?php
$link = mysqli_connect("localhost", "root", "", "google_map");
$id = 2;

if (mysqli_connect_errno()) {
    printf("Connect failed: %s", mysqli_connect_error());
    exit();
}
$query = "SELECT `city`, `post_code`, `street`, `house_number`, `flat_number` FROM `map` WHERE `id`= $id";
$result = mysqli_query($link, $query);

        $row = mysqli_fetch_row($result);
    echo printf("%s, %s, %s, %s, %s", $row[0], $row[1], $row[2], $row[3], $row[4]);

    if($row[4]== "") {
        $address = $row[0].', '.$row[1].', '.$row[2].', '.$row[3];
    }
    else {
        $address = $row[0].', '.$row[1].', '.$row[2].', '.$row[3].', '.$row[4];
    }

     include("maps.php"); 
?>

****HTML

<!DOCTYPE html>
<html>
  <head>
    <title>Google Maps</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="UTF-8">
    <style>
      #map {
        height: 50%;
        width: 30%;
      }
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>

      <input id="address" type="hidden" value="<?php echo $address; ?>">
      <input id="submit" type="hidden" value="Geocode">
    <div id="map"></div>
    <script src="geo.js"></script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=***********************************&callback=initMap">
    </script>

  </body>
</html>

****JS

      function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 10,
          center: {lat: 51.297, lng: 22.886}
        });
        var geocoder = new google.maps.Geocoder();

        geocodeAddress(geocoder, map);
      }
      function geocodeAddress(geocoder, resultsMap) {
        var address = document.getElementById('address').value;
        geocoder.geocode({'address': address}, function(results, status) {
          if (status === 'OK') {
            resultsMap.setCenter(results[0].geometry.location);
            var marker = new google.maps.Marker({
              map: resultsMap,
              position: results[0].geometry.location
            });
            var infowindow = new google.maps.InfoWindow({
        content: document.getElementById('address').value,
        maxWidth: 300
      });
      marker.addListener("click", function() {
        infowindow.open(map, marker);
      });

          } else {
            alert('Geocode was not successful for the following reason: ' + status);
          }
        });
      }