Files
intaleq_v3_pure_php/ride/driverWallet/getDriverDetails.php
2026-04-28 13:04:27 +03:00

34 lines
736 B
PHP

<?php
require_once __DIR__ . '/../../connect.php';
$driver_phone = filterRequest("driver_phone");
$sql = "SELECT
`driverToken`.`token`,
`driver`.`id`,
`driver`.`phone`,
`driver`.`name_arabic`as name,
driver.national_number
FROM
`driverToken`
LEFT JOIN `driver` ON `driver`.`id` = `driverToken`.`captain_id`
WHERE
`driver`.`phone` = '$driver_phone'";
$stmt = $con->prepare($sql);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($data) {
// Print the car location data as JSON
echo json_encode([
'status' => 'success',
'data' => $data
]);
} else {
// Print a failure message
jsonError($message = "No car locations found");
}
?>