Update: 2026-06-29 23:09:43
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$driver_id = filterRequest("driver_id");
|
||||
|
||||
$sql = "SELECT
|
||||
|
||||
cl.driver_id,
|
||||
cl.latitude,
|
||||
cl.longitude,
|
||||
cl.heading,
|
||||
cl.speed,
|
||||
cl.status,
|
||||
cl.created_at,
|
||||
cl.updated_at,
|
||||
d.gender,
|
||||
cr.model
|
||||
FROM
|
||||
car_locations cl
|
||||
LEFT JOIN driver d ON
|
||||
cl.driver_id = d.id
|
||||
LEFT JOIN CarRegistration cr ON
|
||||
cl.driver_id = cr.driverID
|
||||
WHERE
|
||||
cl.driver_id = '$driver_id'
|
||||
ORDER BY
|
||||
created_at
|
||||
DESC
|
||||
LIMIT 1;";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
$car_locations = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($car_locations) {
|
||||
// Print the car location data as JSON
|
||||
printSuccess($data = $car_locations);
|
||||
} else {
|
||||
// Print a failure message
|
||||
printFailure($message = "No car locations found");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user