help with query

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

 



Hello All,

 

I have this string defined for my query and it shows the different types of
categories fine, but when I change a.categoryid = c.categoryid to
a.categoryid = 1 which is only one of the categories

It shows me the same record twice.

 

$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";

 

 

        while ( $row = mysql_fetch_array($res) ) {

                $tpldata['articles'][] = array(

                        'title'         => $row['title'],

                        'intro'         => makeLinks($row['intro']),

                        'id'            => $row['articleid'],

                        'categoryname'  => $row['name'],

                        'created'       => date('n/j/Y',
$row['datecreated'])

                );

                //echo $row['datecreated'];

        }

 

Any Ideas???

 

 

Thanks!

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux