RE: [PHP] Date Arithmetic
| From: | John W. Holmes | Date: | Tue, 01 Oct 2002 22:03:53 +0000 |
| Subject: | RE: [PHP] Date Arithmetic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118442@lists.php.net to get a copy of this message | ||
> I have a small but hard to solve problem to solve.
> Wrote a Select Query for my webpage.
> The query should select all values which where
> written into the DB the last seven Days.
> I thought everything was working fine, but now
> the month has changed and everything went
> wrong.
> My Select Query is not able to go into the Last
> month in calculation.
> I don't really know how to manage this problem.
> Here is the Query:
> $Query = "SELECT * FROM bild_db WHERE datum > '".date('Y') .
> '-' .
> date('m') . '-' . (date('d') - $_REQUEST['days']) .
> ' 00:00:00'."'";
SELECT * FROM bild_db WHERE datum BETWEEN NOW() AND NOW() - INTERVAL 7
DAY;
---John Holmes...