Initial commit with updated Auth and media ignored
This commit is contained in:
23
ride/rides/getTripCountByCaptain.php
Normal file
23
ride/rides/getTripCountByCaptain.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
$driver_id = filterRequest("driver_id");
|
||||
|
||||
$sql = "
|
||||
SELECT COUNT(*) as count
|
||||
FROM `ride`
|
||||
WHERE driver_id = :driver_id AND status = 'Finished'
|
||||
";
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindParam(':driver_id', $driver_id, PDO::PARAM_INT); // أو PARAM_STR حسب نوع الـ ID
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
jsonSuccess($row);
|
||||
} else {
|
||||
jsonError($message = "No finished ride records found for this driver");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user