Or do the same with the BETWEEN keyword:

SELECT * FROM dates WHERE store='$store' AND date BETWEEN DATE_SUB(now(),
interval 3 day) AND DATE_ADD(now(), interval 3 day)




Richard Davey wrote:


Hello Cameron,

Tuesday, December 2, 2003, 1:08:19 AM, you wrote:

CS> $sql = "SELECT * from dates where store=$store and date=$date";

CS> ultimately I would like to display data for 3 days on either side of
CS> this.


The following is un-tested, but a quick look over the MySQL manual
should firm this up for you:

SELECT * FROM dates WHERE store='$store' AND date > DATE_SUB(now(),
interval 3 day) AND date < DATE_ADD(now(), interval 3 day)




-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to