<?php
include "../../connect.php";
$driver_id = filterRequest("driver_id");

$sql = "SELECT
  COUNT(id) AS count
FROM
  `ride`
WHERE
  `ride`.`status` = 'Finished'
  AND driver_id = '$driver_id'
  AND created_at >= CURDATE();
";
$stmt = $con->prepare($sql);
$stmt->execute();

if ($stmt->rowCount() > 0) {
    // Fetch the record
    $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
    

    printSuccess( $row);
    
}
    else{
    // Print a failure message
    printFailure($message = "No wallet record found");
}
?>