i use google map for showing user's location by using markers and a popup window that include name of each user and profile picture
but the problem is that the profile picture of the logged in user is displayed on all markers not the profile picture of the owner marker but the name is the right name
can anyone help me ???
i want each marker to display the profile picture of the owner marker
map.php
<script type="text/javascript">
var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
new google.maps.Size(32, 32), new google.maps.Point(0, 0),
new google.maps.Point(16, 32));
var center = null;
var map = null;
var currentPopup;
var bounds = new google.maps.LatLngBounds();
function addMarker(lat, lng, info) {
var pt = new google.maps.LatLng(lat, lng);
bounds.extend(pt);
var marker = new google.maps.Marker({
position: pt,
icon: icon,
map: map
});
var popup = new google.maps.InfoWindow({
content: info,
maxWidth: 300
});
google.maps.event.addListener(marker, "click", function() {
if (currentPopup != null) {
currentPopup.close();
currentPopup = null;
}
popup.open(map, marker);
currentPopup = popup;
});
google.maps.event.addListener(popup, "closeclick", function() {
map.panTo(center);
currentPopup = null;
});
}
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(0, 0),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
}
});
<?php
$query = mysql_query("SELECT lattitude, user_name,village_name, longitude FROM members u
INNER JOIN village v
ON u.village = v.id")or die(mysql_error());
while($row = mysql_fetch_array($query))
{
$name = $row['user_name'];
$lat = $row['lattitude'];
$lon = $row['longitude'];
//****for image *****//
$sql = mysql_query("SELECT * FROM members") or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$username = $row['user_name'];
//***************for upload img*****************
$check_pic="members/$id/image01.jpg";
$default_pic="members/0/image01.jpg";
if(file_exists($check_pic))
{
$user_pic="<img src=\"$check_pic\"width=\"100px\"/>";
}
else
{
$user_pic="<img src=\"$default_pic\"width=\"100px\"/>";
}
//var_dump($query);
}
echo("addMarker($lat, $lon, '<b>$name</b><br /> $user_pic');
");
}
?>
center = bounds.getCenter();
map.fitBounds(bounds);
}
</script>
<script type="text/javascript">