33 lines
662 B
PHP
Executable File
33 lines
662 B
PHP
Executable File
<?php
|
|
|
|
require_once __DIR__ . '/../../connect.php';
|
|
$passenger_id = filterRequest("passenger_id");
|
|
|
|
$sql = "SELECT
|
|
`id`,
|
|
`title`,
|
|
`body`,
|
|
`passenger_id`,
|
|
`isShown`,
|
|
`created_at`,
|
|
`updated_at`
|
|
FROM
|
|
`notifications`
|
|
WHERE
|
|
`passenger_id` = :passenger_id
|
|
AND `created_at` >= CURDATE() - INTERVAL 7 DAY
|
|
ORDER BY `created_at` DESC
|
|
LIMIT 10";
|
|
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(':passenger_id', $passenger_id, PDO::PARAM_STR);
|
|
$stmt->execute();
|
|
$notifications = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if ($notifications) {
|
|
jsonSuccess($notifications);
|
|
} else {
|
|
jsonSuccess([], "No notification data found");
|
|
}
|
|
|
|
?>
|