<?

	include_once('db.inc.php');

	$mydb = new db();
	$stmt="SELECT * FROM kk_kategoria ORDER BY nev";
	$result=$mydb->query($stmt);


	while ($row = mysql_fetch_object($result)) {
		printf("<tr><td width=\"212\" valign=\"top\" bgcolor=\"#FFFFF6\"><img border=\"0\" src=\"images/negyszog.gif\" hspace=\"3\" width=\"8\" height=\"8\" /><a href=/cimtar.php?c=%s&filter=0>%s %s</a></td></tr>", $row->id, $row->nev, cc_lista($row->id));
	}


function cc_lista($c){

	include_once('db.inc.php');

	if($c==0 || !isset($c)){
		return null;
		exit;
	}

	$mydb = new db();

	$stmt="SELECT COUNT(*) AS darab FROM kk_tag WHERE (kategoria_1=$c OR ((kategoria_2=$c OR kategoria_3=$c OR kategoria_4=$c OR kategoria_5=$c OR kategoria_6=$c OR kategoria_7=$c OR kategoria_8=$c ) AND ext=1)) AND jovahagyva=1";

	$result=$mydb->query($stmt);

	$row = mysql_fetch_object($result);

	return "(".$row->darab.")";

}


?>