Hi,
I'm having troubles with subcategories.
I want to display this on my page with 1 sql query:
- Category 1:
- Sub cat 1
- Sub cat 2
- ...
- Sub cat n
- Category 2:
- Sub cat 1
- Sub cat 2
- ...
- Sub cat n
- Category 3:
- Sub cat 1
- Sub cat 2
- ...
- Sub cat n
- ...
Table schema:
- categories
- id | catname | description
- subcategory
- id | parent_id | catname | description
Currently I'm using a query for the categories and in the PHP while loop another query for subcategories, but this gives me A LOT of queries on one page