i have this code trying to show some points on the map from my database, i dont get any erros at all i just get a blank map with no points.
1) i would like to know what is my mistake in this
2) how can i change the marke sign with something else
3) i want to view only a spesific id from my database,
i know that i must change the "SELECT * FROM tbl_track" to "SELECT * FROM tbl_track where id='11'"
but what is the code i must make if the id is in a list view and if i press the spesifc id i want to pass the parameter to the php and instead of the where id ='11' u need to put a variable something like id=listview1 but how???
i would apriciate if you can help
my database
my php code
1) i would like to know what is my mistake in this
2) how can i change the marke sign with something else
3) i want to view only a spesific id from my database,
i know that i must change the "SELECT * FROM tbl_track" to "SELECT * FROM tbl_track where id='11'"
but what is the code i must make if the id is in a list view and if i press the spesifc id i want to pass the parameter to the php and instead of the where id ='11' u need to put a variable something like id=listview1 but how???
i would apriciate if you can help
my database
my php code
B4X:
<?php
$host = "localhost";
$db = "mydb";
$user = "myuser";
$pw = "12345";
//include ("db.php");
$dbcnx= mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Map API V3 with markers</title>
<style type="text/css">
body { font: normal 10pt Helvetica, Arial; }
#map { width: 700px; height: 700px; border: 0px; padding: 0px; }
</style>
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
<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: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
}
});
<?php
$res = mysqli_query($dbcnx, "SELECT * FROM tbl_track");
while ($row = mysqli_fetch_array($res)){
$lat=$row['latitude'];
$lon=$row['longitude'];
$info="id: ".$row['id']."<br/>user_name: ".$row['user_name']."<br/>".$row['time']."<br/>".$row['speed'];
echo ("addMarker($lat, $lon,'$info');\n");
}
?>
center = bounds.getCenter();
map.fitBounds(bounds);
}
</script>
</head>
<body onload="initMap()" style="margin:0px; border:0px; padding:0px;">
<div id="map"></div>
</html>