My android app will send the name,mobile number,latitude and longitude values (for every 15 minutes)to the database(image provided).
Using that values I need to show the path on google map on a "WEB PAGE".The database maintains more than one person location details.
So,I've created a dropdown where we need to select the name and search which will give the path of that particular person.
Here my code snippet goes:
<!DOCTYPE html>
<html dir="***" id="******">
<head>
<?php include_once "title.php"; ?>
<!--Map Script Starts Here-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["map"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Lat', 'Long', 'Name'],
<?php
$query = "SELECT DISTINCT * FROM information ORDER BY id DESC ";
$result = $dbConnection->prepare($query);
$result->execute();
if($result->rowCount() >0)
{
$num = $result->rowCount();
while($row = $result->fetch())
{
$mobile = $row['mobile'];
$latitude = $row['latitude'];
$longitude = $row['longitude'];
$query1 = "SELECT * FROM information WHERE mobile=? ORDER BY id DESC";
$result1 = $dbConnection->prepare($query1);
$result1->execute(array($mobile));
$row1 = $result1->fetch();
$cname = $row1['name'];
echo "[$latitude, $longitude, '$cname'],";
}
}
?>
]);
var map = new google.visualization.Map(document.getElementById('map_div'));
map.draw(data, {showTip: true, enableScrollWheel: true, useMapTypeControl: true});
}
</script>
<!--Map Script Ends Here-->
</head>
This code is not fulfilling the requirement
Output
how to draw path among these points
Database:
If I use poly lines it is drawing a line but i need the path