Hi,
I have a problem I just cant solve.
First I will explain what I am trying to do.
I have a page with a menu consisting of categories of products, some of these categories have subcategories and some don't.
Categories and subcategories are kept in mysql tables. The tables are set out as so:
categories
id: int(10) primary ai null(no)
category: varchar(100) null(no)
subcategory:
id: int(10) primary ai null(no)
category: varchar(100) null(no)
cat_id: int(10)
I have code to add categories to the category table. And I have code to add subcategories to the subccategory table that takes the id value of category and puts the same value in the cat_id field of subcategory.
I now want to add products, I need it so that when i click a category that has no subcategory all the products for that category are displayed. And for categories with subcategories the products for each subcategory are displayed when the subcategory is clicked.
I dont think I have my tables set up right, I think i need both tables to have a common field?
Can anyone offeer advice on how to do this?
Thanks for looking.................