将mysql数据库的id添加到谷歌地图标记

时间:2013-08-18 18:48:22

标签: php mysql google-maps maps

我有来自mysql的以下代码我想为标记分配一个ID,有人可以帮助我。

我已经看过其他帖子,但我无法在记分牌上添加BD的ID,然后我必须将其分配给表单的输入,一些ejempo或解决方案,谢谢

var place = new Array();
var id = new Array();
var marker;          

<?php
   for ($i=0; $i < sizeof($regSectores); $i++){
?>
   place['<?php echo $regSectores[$i]["nombreSector"];?>'] = new 
      google.maps.LatLng(<?php echo $regSectores[$i]["latitud"];?>, <?php echo $regSectores[$i]["longitud"];?>);
   id['<?php echo $i; ?>'] = <?php echo $regSectores[$i]["idSector"];?>;               
<?php  
} 
?>

var j = 0;
for(var i in place){
   marker = new google.maps.Marker({
      position: place[i], 
      map: mapa, 
      title: i, 
      icon: 'img/marker.png',
      animation: google.maps.Animation.DROP                                 
   });

   marker.ID = id[j];                   

   google.maps.event.addListener(marker, 'click', function(){                    
      alert(marker.ID);
   })  

   j++;
}                

});

0 个答案:

没有答案