Good day all, I'm developing a small script that has to check if an entry from a MySQL database is at least older than 10 days from now. the table has a timestamp field (which is the one I would like to use, but I can change it if needed). Actually I'm using this sql string:
SELECT *
FROM entries
WHERE tag='$tag'
AND DATE(last_update) > DATE_SUB(CURDATE(), INTERVAL 10 DAY)
but I'm discovering some selected entries "younger" than 10 days so maybe I'm mistaking something. is this the right way or is better to check it via PHP (and not with the MySQL query) ?
thanks in advance.
older than 10 days
should be before
the calculated date.
SELECT * FROM entries
WHERE tag='$tag' AND DATE(last_update) < DATE_SUB(CURDATE(), INTERVAL 10 DAY)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With