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 '
(last known position where I had a GPS signal, a network connection, and some battery power)
All times in UTC' . date('P') . '.
'; } } else { die("No records found."); } $conn->close(); ?>