subdate

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

 



hello,
thank you for your time.

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")
$obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked' and
createdate >=subdate(now(), interval 1 day)");


this does not: (*note end of syntax "interval 14 days")
$obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked' and
createdate >=subdate(now(), interval 14 days)");


this does not: (*note end of syntax "interval 2 weeks")
$obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked' and
createdate >=subdate(now(), interval 2 weeks)");


this works: (*note end of syntax "interval 1 month")
$obj = mysql_db_query($dbname,"select a.*,s.name as subcategory_name,c.name as category_name from ads a,subcategory s,
category c where a.subcategory=s.id and s.category=c.id and a.subcategory=$id and a.que='checked' and
createdate >=subdate(now(), interval 1 month)");
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
addison@bellsouth.net
info@smipco.com
subsidiaries of small independent publishing co.
info@gloabaldog.com
info@momandpocentral.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