I am trying to count the number of items in a shopping category.
I have read as much as possible but can't find a suitable solution.
Will appreciate your assistance.
With the present code (below), I can get the count but the display is not working.
What I want;
wine (4) juice(6) beer (27) whisky(23) numbers are arbitrary
No what I get:
If I click on wine, I get wine (4) juice(4) beer (4) whisky (4)
If I click on beer, I get wine (27) juice(27) beer (27) whisky (27)
I guess I am not properly associating the cat names with the count.
$selQuery4 = "SELECT DeptName FROM tbl_product WHERE id_company='$idcompany' group BY DeptName";
$selResult4=kal_query($selQuery4);
$subQuery4="SELECT COUNT(*) from tbl_product WHERE DeptName like '%$caption%' and id_company='$id_company' and DeptName='$DeptName'group by DeptName,id_product";
$subResult4=kal_query($subQuery4);
$compcount=0;
while($row4=newFetch($selResult4))
{
//$id_product=$row->id_product;
$id_product=$row4->id_product;
$id_company=$row4->id_company;
$DeptName=$row4->DeptName;
$id_dept=$row4->id_dept;
$count = kal_num_rows($subResult4);
$valListProduct5 .="<TD align=left bgColor=white valign=top><a href='category.php?caption=".rawurlencode($DeptName)."&DeptName=".rawurlencode($DeptName)."' class=prod_link>$DeptName ($count)</a></TD></TR>";
Script is using FastTemplate.
Thank you