RE: [PHP-DB] subdate

From: Date: Thu, 06 Feb 2003 07:51:22 +0000
Subject: RE: [PHP-DB] subdate
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25483@lists.php.net to get a copy of this message
> please note the time "intervals" that are working. what i > want is to select only data that is two weeks old or younger. i did a > test with one day and it worked great. i inserted the two-week/14days > and neither of them worked. 1 month worked. i could not find anything > on php.net that directed me to this. thank you again, addison > > this works:(*note end of syntax "interval 1 day") > createdate >=subdate(now(), interval 1 day)"); > this does not: (*note end of syntax "interval 14 days") > createdate >=subdate(now(), interval 14 days)"); > this does not: (*note end of syntax "interval 2 weeks") > createdate >=subdate(now(), interval 2 weeks)"); > this works: (*note end of syntax "interval 1 month") > createdate >=subdate(now(), interval 1 month)"); Take a look at http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html #Date_and_time_functions and see why DAYS and WEEKS is causing you trouble. You're still not checking mysql_error() when you issue a query, are you? Otherwise you may have figured it out already. And, you're still using mysql_db_query(), which is depreciated. :( ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#25483) next »