[PHP-DB] Date problem again ;-)

2005-03-22 Thread Chris Payne
Hi there everyone,

 

OK I'm using the following in my query to display entries in the LAST 3
days:

 

DATE_SUB(CURDATE(),INTERVAL 3 DAY) = ListingDate

 

But it doesn't seem to affect the results, the date format in my DB column
(ListingDate - datatype is Date) is 2000-00-00 as in year, month and date -
is THAT the problem?  That it needs to be an actual timestamp?  If that is
the case I'm not sure how to approach this because the data MUST be in the
above format as it comes from a central DB every night.  All I need to do is
display the current date plus also the previous x amount of days in between.

 

I'm using PHP 4 with MySQL 4.0.22 (Not the latest MySQL I know, sigh).

 

Chris



Re: [PHP-DB] Date problem again ;-)

2005-03-22 Thread Forest Liu
I suppose there is a  submit_time field in your DB table, so you could:
SELECT * FROM `tablename` WHERE `submit_time`=.lastdays(3)

lastdays() is a function you could create using mktime(),time(), and date()


On Tue, 22 Mar 2005 16:28:39 -0500, Chris Payne [EMAIL PROTECTED] wrote:
 Hi there everyone,
 
 OK I'm using the following in my query to display entries in the LAST 3
 days:
 
 DATE_SUB(CURDATE(),INTERVAL 3 DAY) = ListingDate
 
 But it doesn't seem to affect the results, the date format in my DB column
 (ListingDate - datatype is Date) is 2000-00-00 as in year, month and date -
 is THAT the problem?  That it needs to be an actual timestamp?  If that is
 the case I'm not sure how to approach this because the data MUST be in the
 above format as it comes from a central DB every night.  All I need to do is
 display the current date plus also the previous x amount of days in between.
 
 I'm using PHP 4 with MySQL 4.0.22 (Not the latest MySQL I know, sigh).
 
 
 Chris
 
 


-- 
   Sincerely,
 Forest Liu()

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