I am currently working on a website that displays markers on Google Maps based on PHP data from a mySQL database. I recently figured out how to connect the data together, but the loop that is supposed to print multiple markers only prints out one. I browsed this website for similar questions such as this but either found out of date code or code that I could not understand.
Goal: Display multiple different markers on the maps Problem: Even though the loop is supposed to print 4 of the markers, it only prints one.
Code:
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: {lat: 25.363, lng: 131.044}
});
var marker, i;
var count = <?php echo $count;?>;
for (var i = 0; i < count; i++) {
marker = new google.maps.Marker({
position: {
lat: <?php echo $lat[$count2]; ?>,
lng: <?php echo $long[$count2]; ?>
},
map: map,
});
}