Parašė ramon· 2008 Rugp. 24 14:08:46
#10
Stai imk si koda cia rodo visas esancias kategorijas ir rusiuoja pagal kiek yra straipsniu kategorijiuose:
<?
opentable("");
$a = dbquery("SELECT article_cat, COUNT(article_id) as kiek_straipsniu FROM ".$db_prefix."articles GROUP BY article_cat ORDER BY kiek_straipsniu DESC");
while($b = dbarray($a)) {
$c = dbquery("SELECT article_cat_id, count(article_cat_id) as g, article_cat_name FROM ".$db_prefix."article_cats WHERE article_cat_id='".$b['article_cat']."' GROUP BY article_cat_id ORDER BY g DESC");
while($d = dbarray($c)) echo "<b>Pavadinimas:</b> ".$d['article_cat_name']." (<b>Straipsniu:</b> ".$b['kiek_straipsniu'].")<Br>";
}
closetable();
?>