In a MySQL 5.1 InnoDB environment, what is the best way to SELECT data based on date intervals?
Letting MySQL do it via something like DATE_SUB(CURDATE(), INTERVAL 5 DAY) > created_at
Or have PHP prepare the date before submission via strtotime
?
In a MySQL 5.1 InnoDB environment, what is the best way to SELECT data based on date intervals?
Letting MySQL do it via something like DATE_SUB(CURDATE(), INTERVAL 5 DAY) > created_at
Or have PHP prepare the date before submission via strtotime
?
I would do it via the query to MySql. That way, you keep the logic of selecting dates out of the PHP. The PHP just handles the display, and you get the advantage of smaller chunks of data coming out of the database as well.