Update: 2026-08-01 03:01:01

This commit is contained in:
Hamza-Ayed
2026-08-01 03:01:01 +03:00
parent af77727f4a
commit 414965de45
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ try {
// echo $con; // echo $con;
// --- JWT Authentication --- // --- JWT Authentication ---
include "functions.php"; // Include the functions file include __DIR__ . "/functions.php"; // Include the functions file
$decodedToken = authenticateJWT(); // Call the authentication function $decodedToken = authenticateJWT(); // Call the authentication function
@@ -3,13 +3,13 @@ include "../../connect.php";
$passenger_id = filterRequest("passenger_id"); $passenger_id = filterRequest("passenger_id");
$sql = "SELECT $sql = "SELECT
COALESCE(dummy.passenger_id, '$passenger_id') AS passenger_id, COALESCE(dummy.passenger_id, :passenger_id) AS passenger_id,
COALESCE(SUM(pw.balance), 0) AS total, -- Adjust column to represent payments COALESCE(SUM(pw.balance), 0) AS total, -- Adjust column to represent payments
COALESCE(p.first_name, '') AS first_name, COALESCE(p.first_name, '') AS first_name,
COALESCE(p.last_name, '') AS last_name, COALESCE(p.last_name, '') AS last_name,
COALESCE(p.phone, '') AS phone COALESCE(p.phone, '') AS phone
FROM FROM
(SELECT '$passenger_id' AS passenger_id) AS dummy (SELECT :passenger_id2 AS passenger_id) AS dummy
LEFT JOIN `passengerWallet` pw ON pw.passenger_id = dummy.passenger_id LEFT JOIN `passengerWallet` pw ON pw.passenger_id = dummy.passenger_id
LEFT JOIN passengers p ON p.id = dummy.passenger_id LEFT JOIN passengers p ON p.id = dummy.passenger_id
GROUP BY GROUP BY
@@ -17,7 +17,7 @@ GROUP BY
LIMIT 0, 25; LIMIT 0, 25;
"; ";
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->execute(); $stmt->execute(['passenger_id' => $passenger_id, 'passenger_id2' => $passenger_id]);
if ($stmt->rowCount() > 0) { if ($stmt->rowCount() > 0) {
// Fetch the record // Fetch the record