SELECT id FROM videos WHERE dateAdded BETWEEN DATE_ADD(CURDATE(),INTERVAL -1 day) AND CURDATE()
The query above does as expected in phpMyAdmin and returns several results within the date range, but when I run the query within the php script the result is always empty (false).
This query gives results
SELECT id FROM videos WHERE 1
The project is rather old running php 5.3 using PDO to run the mysql statements. PDO::errorInfo() indicates that the query went through without errors. It is as if the WHERE part was not interpreted or it was in a different way.
dateAdded is a dateTime parameter that stores the current timestamp of the creation of that particular row.
I already tried to replace the 2 dates with preformatted dates e.g. '2021-06-11 00:00:00' but it did not change anything.