diff --git a/location.php b/location.php index e69de29..d4f0966 100644 --- a/location.php +++ b/location.php @@ -0,0 +1,53 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$sql = "SELECT ts, lat, lon FROM tracker WHERE device='" . mysqli_real_escape_string($conn, $_GET["device"]) . "' ORDER BY ts DESC LIMIT 1;"; +$result = $conn->query($sql); + +if ($result->num_rows > 0) { + + while($row = $result->fetch_assoc()) { + print ' + + + + Current Location + + + + + + + +

My location at ' . $row["ts"] . '

+

(last known position where I had a GPS signal, a network connection, and some battery power)

+ +
+ + + +'; + } +} else { + die("No records found."); +} + +$conn->close(); + +?> +