Loope gennem SQL result og tilføje marker til google map
Nedenstående fungerer med kun 1 row i database. Så snart jeg har 2 fejler siden, og jeg får ikke markør nr. 2 placeret - hvorfor ?<html>
<META HTTP-EQUIV=Refresh CONTENT="30">
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type='text/javascript' src="http://maps.google.com/maps/api/js?sensor=false&.js"></script>
<style type='text/css'>
#map {
width: 1000px;
height: 1000px;
}
</style>
</head>
<body>
<div id="map"></div>
<script type='text/javascript'>//<![CDATA[
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: new google.maps.LatLng(55, 11),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
function placeBallon(lat, lng, high, tim, nam) {
//alert(" Adding marker " + lat + "," + lng + "," + tim);
this.lat = lat;
this.long = lng;
var location = new google.maps.LatLng(lat, long);
var marker = new google.maps.Marker({
position: location,
title: ""+tim+" "+nam+ " - Ballon height: " + high + " Meters",
map: map,
draggable: false
});
map.setCenter(location);
}
<?php
while($row = mysql_fetch_array($result))
{
echo "placeBallon(" . $row['Latitude'] . "," . $row['Longitude'] . "," . $row['Height'] . ",'" . $row['Log_Time'] . "','" . $row['Log_Name'] . "')";
}
?>
</script>
</body>
</html>