first commit
This commit is contained in:
33
backend/ride/notificationPassenger/get.php
Executable file
33
backend/ride/notificationPassenger/get.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user