----- Original Message -----
From: Russ Michell <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 22, 2001 10:16 PM
Subject: [PHP-DB] Query construction (again)
> Hey there folks - similar problem - different project!
>
> I want to select some records for a period of 7days after their insert
[dateFrom] date.
> Last time I asked you guys for help I was helped toward the following
solution:
>
> $sql = "SELECT * FROM $Tpostings WHERE now()>=dateFrom AND now()<dateTo";
>
> The problem in this new project is that the 'dateTo' field is not included
in the DB. It is 7-days
> after 'dateFrom'. So why does the following query not work:
>
> $sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7
DAY)";
> No error is received though...
There is no comparison in your WHERE clause. Try something like:
$sql = "SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) =
now()";
Depending on how the date is stored (date + time, or just date) you may have
to modify the output of now() to match.
hth
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]