Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: news_comments atvaizdavimas

Parašė _Tomas· 2009 Lap. 19 01:11:42
#1

opentablenw("");
echo "<table cellpadding='0' cellspacing='0' width='750'><tr>
<td width='150' class=tbl1 >Pavadinimas</td><td class=tbl1 width=60 >Komentarai</td><td class=tbl1 width=60 >Skaityta</td></tr>";
$result2 = dbquery("SELECT * FROM ".$db_prefix."news ORDER BY news_datestamp DESC LIMIT 20");
while ($data2 = dbarray($result2)) {
$result = dbquery("SELECT * FROM ".$db_prefix."news_cats WHERE news_cat_id='".$data2['news_cat']."' ");
$data = dbarray($result);

echo "<tr><td class=tbl1><img src='".THEME."images/bullet.gif' alt=''> ".$data['news_cat_name'].": <a href='news.php?readmore=".$data2['news_id']."'>".$data2['news_subject']."</a><br></td><td class=tbl1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$data2['news_comments']."</td><td class=tbl1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$data2['news_reads']."</td></tr>";

}
echo "</table>";
closetablenw();




Naujausių naujienų panelė. Kažkodėl nenori atvaizduoti news_comments... Bandžiau su dbcount, bet neišeina.

Any Ideas?

Parašė bruzgis· 2009 Lap. 19 02:11:19
#2

opentablenw("");
echo "<table cellpadding='0' cellspacing='0' width='750'><tr>
<td width='150' class=tbl1 >Pavadinimas</td><td class=tbl1 width=60 >Komentarai</td><td class=tbl1 width=60 >Skaityta</td></tr>";
$result = dbquery(
         "SELECT tn.*, tc.* FROM ".$db_prefix."news tn
         LEFT JOIN ".$db_prefix."news_cats tc ON tn.news_cat=tc.news_cat_id
         WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().")
         ORDER BY news_datestamp DESC LIMIT 0, 20"
      );
while ($data = dbarray($result)) {
$komentarai = dbcount("(comment_id)", "comments", "comment_type='N' AND comment_item_id='".$data['news_id']."'");
echo "<tr><td class=tbl1><img src='".THEME."images/bullet.gif' alt=''> ".$data['news_cat_name'].": <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."'>".$data['news_subject']."</a><br></td><td class='tbl1' style='padding-left:10px;'>" . $komentarai . "</td><td class='tbl1' style='padding-left:10px;'>".$data['news_reads']."</td></tr>";
}
echo "</table>";
closetablenw();




Prasom ;)