oohoohoohooh
Programmer
Hi, I wish to create a navigation bar for users to follow as they browse a store I am creating. The following is the table structure for the categories table:
- cat_id
- subcat_id (if 0 then not a subcat)
- cat_name
This allows me to have unlimited subcats. An example of some values are
1 | 0 | Music, Video
2 | 1 | Music
3 | 1 | Video
4 | 2 | Classical
5 | 2 | Rock, Pop
6 | 5 | Rock
7 | 5 | Pop
Then the navigation bar (for the pop category) would be:
Music, Video -> Music -> Rock, Pop -> Pop
How would I generate such a navigation bar without having to do loads and loads of sql queries. I'd appreciate your help. Thanks
- cat_id
- subcat_id (if 0 then not a subcat)
- cat_name
This allows me to have unlimited subcats. An example of some values are
1 | 0 | Music, Video
2 | 1 | Music
3 | 1 | Video
4 | 2 | Classical
5 | 2 | Rock, Pop
6 | 5 | Rock
7 | 5 | Pop
Then the navigation bar (for the pop category) would be:
Music, Video -> Music -> Rock, Pop -> Pop
How would I generate such a navigation bar without having to do loads and loads of sql queries. I'd appreciate your help. Thanks