I'm creating a basic shopping cart in PHP and was wondering, what is the best way of storing and generating a list of categories in a hierarchy format with unlimited subcategories?
Currently I load the main categories and then foreach
I get the subcategories from the database and so on, which on a large site would create over 100 queries.
So whats a better way of doing things?
Heres my current MySQL table structure:
cat_id
cat_name
cat_desc
cat_parent_id
status
priority
I'm aiming for 1 query.