On 06/07/2012 09:37 AM, Jack wrote:
$query = "select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate = -1 or
a.startdate<= {$now}) and (a.enddate = -1 or a.enddate>= {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC";

$query = "
        SELECT  a.startdate,
                a.articleid,
                c.name,
                a.title,
                a.intro,
                a.datecreated
        FROM    articles as a,
                categories as c
        WHERE   (
                a.startdate = -1
                OR
                a.startdate <= {$now}
                )
        AND     (
                a.enddate = -1
                OR
                a.enddate >= {$now}
                )
-- This line must stay, it is limiting the combination of the data from
-- both tables
        AND     a.categoryid = c.categoryid
-- You need to add this line to make it work, but keep the previous line
        AND     a.categoryid = 1

        ORDER BY a.startdate DESC
";

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

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

Reply via email to