I have 2 MySQL-Tables for a start.
the first one with the category data:
cat_id, sub_id, category_name
TABLE "CATEGORY"
1, 0, "category 1"
2, 1, "category 2"
3, 2, "category 3"
4, 3, "category 4"
5, 1, "category 5"
6, 3, "category 6"
all these categories are within category 1.
why? because the sub_id always refers to the cat_id of the higher category or the category that comes before the one's following...
now I have a second table with articles in it:
TABLE "PRODUCTS"
id is AUTO_INCREMENT and cat_id is the same as cat_id from the CATEGORY table.
id, cat_id, product_name
1, 1, "product 1"
2, 4, "product 2"
3, 4, "product 3"
4, 2, "product 4"
now let's assume I have a html page with links in it that reflect the category structure
an example for above data would be:
category 1 - >>category 2 - >>category 3 - >>category 4
How can I achieve that I'm able to click on any category link and get the results for that category retrieved from the tables PLUS the subcategories that hide behind the level I'm actually on, so I should get ALL FOUR products when I click ">> category 1", only "product 2","product 3","product 4" when I click "category 2" and only "product 2" and "product 3" when I click "category 4"?
thanks in advance