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

$sql = "SELECT
    passengerWallet.`id`,
    passengerWallet.balance,
    passengerWallet.`created_at`
FROM
    `passengerWallet`
WHERE
    passenger_id = '$passenger_id'AND created_at >= DATE_SUB(NOW(), INTERVAL 1 MONTH)
ORDER BY
    `passengerWallet`.`id`
DESC";
$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");
}
?>