RE: subdate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 	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/



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux