Parašė ramon· 2008 Rugp. 24 23:08:48
#23
<?
opentable("");
$id = "news_cat_id='1' || news_cat_id='2'";
$uzklausa_a = "SELECT * FROM ".DB_PREFIX."news_cats WHERE $id ORDER BY news_cat_id ASC";
$a = dbquery($uzklausa_a);
while ($b = dbarray($a)) {
$uzklausa_b = "SELECT news_id, COUNT(news_id) as naujienu FROM ".DB_PREFIX."news WHERE news_cat='".$b['news_cat_id']."' GROUP BY news_cat";
$c = dbquery($uzklausa_b);
while ($d = dbarray($c)) echo "<b>Kategorija:</b> ".$b['news_cat_name']." (<b>Naujienu:</b> ".$d['naujienu'].") <b>ID:</b> ".$b['news_cat_id']."<Br>";
}
closetable();
?>
Pildyt tektu sia eilute:
$id = "news_cat_id='1' || news_cat_id='2'";
Noredemas prideti dar viena kategorija rasai:
|| news_cats_id='ID'