Update: 2026-06-29 23:09:43
This commit is contained in:
42
loction_server/siro/ride/location/getLocationParents.php
Normal file
42
loction_server/siro/ride/location/getLocationParents.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
include "../../connect.php";
|
||||
|
||||
$driver_id = filterRequest("driver_id");
|
||||
|
||||
$sql = "SELECT
|
||||
car_locations.id,
|
||||
car_locations.driver_id,
|
||||
car_locations.latitude,
|
||||
car_locations.longitude,
|
||||
car_locations.heading,
|
||||
car_locations.speed,
|
||||
car_locations.`status`,
|
||||
car_locations.created_at,
|
||||
car_locations.updated_at,
|
||||
`driver`.`gender`,
|
||||
CarRegistration.model
|
||||
FROM
|
||||
car_locations
|
||||
LEFT JOIN `driver` ON `driver`.`id` = car_locations.driver_id
|
||||
LEFT JOIN `CarRegistration`
|
||||
ON `CarRegistration`.`driverID` = CarRegistration.driverID
|
||||
WHERE
|
||||
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