phillystyle123
asked on
Joomla - trying to post articles less than 6 months old
I'm using a module called "Recent News" which scrolls articles from a given category. I need to set the sql so it's only outputting articles that are 6 months old or newer.
here's the sql:
here's the sql:
"SELECT c.id AS id, c.title AS title, c.catid as catid, c.sectionid as sectionid, c.alias as title_alias
FROM #__content AS c
INNER JOIN #__categories AS cat
ON(c.catid = cat.id) AND (cat.access <= $gid)
INNER JOIN #__sections AS sec
ON(c.sectionid = sec.id)
WHERE c.state = '1'
AND ( c.publish_up = " . $database->Quote($nullDate) . " OR c.publish_up <= " . $database->Quote($now) . " )
AND ( c.publish_down = " . $database->Quote($nullDate) . " OR c.publish_down >= " . $database->Quote($now) . " )
AND cat.published = '1'
AND sec.published = '1' ";
ASKER
thanks ray - how would that work in this:
AND ( c.created = " .$database->Quote( date('Y-m-d', strtotime('-90 days')) ). "
AND ( c.created = " .$database->Quote( date('Y-m-d', strtotime('-90 days')) ). "
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so the actual strtotime is
today - 6 months
today - 6 months
Yes. Either "Today" or "Now" should work. "Now" includes the time of day, and "Today" just includes the date (time is midnight).
ASKER
perfecto ray - thanks!
Glad to help. Thanks for the points and thanks for using EE! ~Ray
Now - 6 months
Example:
http://www.laprbass.com/RAY_strtotime.php?s=now+-+6+months
Not sure what column of your DB table would need to be in the WHERE clause, but you probably know that part ;-)