I am trying to show a list reminders with only today's date on and it's only showing anything with today's dte and after today's date.
This is what I have so far;
<?php
include '../../main.php';
check_loggedin($pdo);
$now = date("Y-m-d h:i:sa");
$stmt = $pdo->prepare('SELECT * FROM care_plan_review where reminder_date > ? order by id desc');
$stmt->execute([$now]);
$allReview = $stmt->fetchAll(PDO::FETCH_ASSOC);
// var_dump($now);
// exit();
?>
CodePudding user response:
To show the records only belongs to today you can use following SQL query.
SELECT * FROM care_plan_review where reminder_date = ? order by id desc
Here is the modified code,
<?php
include '../../main.php';
check_loggedin($pdo);
$now = date("Y-m-d"); // Use only date
$stmt = $pdo->prepare('SELECT * FROM care_plan_review where reminder_date = ? order by id desc');
$stmt->execute([$now]);
$allReview = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>