hi,
I got this PHP code and this shows the categories and subcategories like this:
Shampoo (2)
-----------PertPlus
-----------SunSlik
Soup (1)
-----------Lux
ToothPaste (3)
-----------Creast
-----------Signal2
-----------Collgate
php code to do this is:
$sql = "SELECT category, subcategory
FROM products
ORDER BY category, subcategory";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$products[$row['category']][] = $row['subcategory'];
}
foreach ($products as $category => $subcategories)
{
$num_subcategories = count($subcategories);
echo "{$category} ({$num_subcategories})\n";
foreach ($subcategories as $subcategory)
{
echo "-----------{$subcategory}\n";
}
}
and I want to show the result like this with rows NUMBERING:
Shampoo (2)
1----------PertPlus
2----------SunSlik
Soup (1)
1----------Lux
ToothPaste (3)
1----------Creast
2----------Signal2
3----------Collgate
Best Regards