I have San Andreas map http://prntscr.com/drd9pz i add some markers using fallow code:
var burgInfoWindow = new google.maps.InfoWindow({
content: '<h3>Burg</h3><p>Ovo je mesto gde se igraci cesto okupljaju i zajedno jedu burgere.</p>'
});
var burgMarker = new google.maps.Marker({
position: SanMap.getLatLngFromPos(1195.3125,-925.78125),
map: map,
icon: 'https://wiki.sa-mp.com/wroot/images2/0/0e/Icon_10.gif'
});
google.maps.event.addListener(burgMarker, 'click', function() {
map.setCenter(burgMarker.position);
burgInfoWindow.open(map,burgMarker);
});
//Uncomment to show an alert with the position when you click on the map
google.maps.event.addListener(map, 'click', function(event) {
var pos = SanMap.getPosFromLatLng(event.latLng);
alert(pos.x + "," + pos.y);
});
Now i want to add markers with location from MySQL base like markers for house,so i take X,Y location of that house from my DB http://prntscr.com/drdaf8 and load X,Y and try to create markers but not work,this is code for that:
<?php
$kuca=mysqli_query($conn,"SELECT * FROM kuce WHERE `kId` > 0");
while($row = mysqli_fetch_array($kuca))
{
$x = $row['kUlazX'];
$y = $row['kUlazY'];
echo
"<script>
var houseInfoWindow = new google.maps.InfoWindow({
content: '<h3>Kuca</h3><p>Ovo je mesto gde igraci zive.</p>'
});
var houseMarker = new google.maps.Marker({
position: SanMap.getLatLngFromPos($x,$y),
map: map,
icon: 'https://wiki.sa-mp.com/wroot/images2/b/b6/Icon_31.gif'});
google.maps.event.addListener(houseMarker, 'click', function() {
map.setCenter(houseMarker.position);
houseInfoWindow.open(map,houseMarker); </script>";
}
?>