Initial commit with updated Auth and media ignored
This commit is contained in:
29
ride/location/getLatestLocationPassenger.php
Normal file
29
ride/location/getLatestLocationPassenger.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
$rideId = filterRequest("rideId");
|
||||
|
||||
$sql = "SELECT
|
||||
*
|
||||
FROM
|
||||
`passengerlocation` pl
|
||||
WHERE
|
||||
pl.rideId = :rideId
|
||||
ORDER BY
|
||||
pl.createdAt
|
||||
DESC
|
||||
LIMIT 1";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute([':rideId' => $rideId]);
|
||||
$car_locations = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($car_locations) {
|
||||
// Print the car location data as JSON
|
||||
jsonSuccess($data = $car_locations);
|
||||
} else {
|
||||
// Print a failure message
|
||||
jsonError($message = "No car locations found");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user