'0') { echo "\n\n"; while($ac = mysql_fetch_array($rc)) { //get the items at this category $qi = "select count(ItemID) from oneshop_producten where ItemCategory = '$ac[CategoryID]' "; $ri = mysql_query($qi) or die(mysql_error()); $ai = mysql_fetch_array($ri); echo "\n\t\n\n"; if($ac[CategoryID] == $_GET[CategoryID]) { //get the subcategories $qs = "select * from devbg_subcategories where CategoryID = '$_GET[CategoryID]' order by SubcategoryName "; $rs = mysql_query($qs) or die(mysql_error()); if(mysql_num_rows($rs) > '0') { while($as = mysql_fetch_array($rs)) { //get the items at this subcategory $qi2 = "select count(ItemID) from oneshop_producten where ItemCategory = '$ac[CategoryID]' and ItemSubcategory = '$as[SubcategoryID]' "; $ri2 = mysql_query($qi2) or die(mysql_error()); $ai2 = mysql_fetch_array($ri2); echo "\n\t\n\n"; } } } } echo "
\n\t$ac[CategoryName] ($ai[0])\n\t
$as[SubcategoryName] ($ai2[0])\n\t
"; } else { echo " "; } ?>