This commit is contained in:
Hamza-Ayed
2026-05-01 02:49:04 +03:00
parent 669baad04f
commit afe1b1c425
2 changed files with 28 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ if (!empty($promo_code)) {
$stmt = $con->prepare($sql);
$stmt->bindParam(':promo_code', $promo_code, PDO::PARAM_STR);
} else {
$sql = "SELECT `id`, `promo_code`, `amount`, `description`, `passengerID`, `validity_start_date`, `validity_end_date` FROM `promos` ORDER BY id DESC";
$sql = "SELECT `id`, `promo_code`, `amount`, `description`, `passengerID`, `validity_start_date`, `validity_end_date` FROM `promos` WHERE `passengerID` IN ('all', 'none', '') ORDER BY id DESC";
$stmt = $con->prepare($sql);
}

View File

@@ -152,6 +152,7 @@ LEFT JOIN driver d ON
LEFT JOIN ride ON ride.id = cm.ride_id
left join payments on payments.rideId=cm.ride_id";
try {
$stmt = $con->prepare($sql);
$stmt->execute();
@@ -178,7 +179,9 @@ if ($row) {
}
jsonSuccess($row);
} else {
// Return empty success for admin dashboard instead of error
jsonSuccess([], "No complaints found");
}
} catch (Exception $e) {
jsonError("Database error: " . $e->getMessage());
}
?>