How I can fix this SQL query to check if a date is older than the actual and is expired and can be deleted?
I've tried with this code but it seems not work
<?php
$date = new DateTime();
$d = $date->format('Y-m-d');
$stmt = $this->db->prepare("DELETE FROM test_table WHERE _out = ? AND _out <= {$d}");
$stmt->execute(array($d));
?>
I've also tried with this query but when the ajax call is made to the controller it seems not work
$stmt = $this->db->prepare("DELETE FROM reservations WHERE check_out <= {$d}");