lol, ok guys, I may need a few more notes here... I added something somewhere to allow it to do this....here's the code for you....atleast this is a learning experience....
//create categories
$qc = "select * from dd_categories order by CategoryName";
$rc = mysql_query($qc) or die(mysql_error());
if(mysql_num_rows($rc) > '0')
{
while($ac = mysql_fetch_array($rc))
{
//get the items number at this category
$qin3 = "select count(*) from dd_items ";
$rin3 = mysql_query($qin3) or die(mysql_error());
$ain3 = mysql_fetch_array($rin3);
$totalnumber .= "Total: ($ain3[0])<br>\n\t\t\t";
$qin = "select count(*) from dd_items where ItemCategory = '$ac[CategoryID]' and ItemStatus = 'approved' ";
$rin = mysql_query($qin) or die(mysql_error());
$ain = mysql_fetch_array($rin);
$categories .= "<a class=CatLinks href=\"ShowCategory.php?CategoryID=$ac[CategoryID]\">$ac[CategoryName] ($ain[0])</a><br>\n\t\t\t";
if($_GET[CategoryID] == $ac[CategoryID])
{
$categories .= "<ul style=\"margin-top:0; margin-bottom:0; margin-left:15\">";
//get the subcategories
$qsc = "select * from dd_subcategories where CategoryID = '$_GET[CategoryID]' order by SubcategoryName ";
$rsc = mysql_query($qsc) or die(mysql_error());
if(mysql_num_rows($rsc) > '0')
{
while($asc = mysql_fetch_array($rsc))
{
//get the items number at this subcategory
$qin2 = "select count(*) from dd_items where ItemCategory = '$_GET[CategoryID]' and ItemSubcategory = '$asc[SubcategoryID]' and ItemStatus = 'approved' ";
$rin2 = mysql_query($qin2) or die(mysql_error());
$ain2 = mysql_fetch_array($rin2);
$categories .= "<li><a class=CatLinks href=\"ShowCategory.php?CategoryID=$ac[CategoryID]&SubcategoryID=$asc[SubcategoryID]\">$asc[SubcategoryName] ($ain2[0])</a></li>";
}
}
$categories .= "</ul>";
}
}
}
so, when I add in <?=$totalnumber?> it adds it up and displays it the as many times as their are categories...
to see it in action, check out
http://www.humorzilla.com/maingreentemplate.php
thanks in advance, again (BP)
Steve