subdate

From: Date: Thu, 06 Feb 2003 07:52:48 +0000
Subject: subdate
Groups: php.db 
Request: Send a blank email to php-db+get-25482@lists.php.net to get a copy of this message
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


« previous php.db (#25482) next »