Forums

PHP

This topic is locked

List Categories with Subscategories

Posted 15 Jan 2004 23:18:27
1
has voted
15 Jan 2004 23:18:27 Randy Roche posted:
I am trying to create a page where data is pulled from MySQL and displayed in an unordered list. There will be main categories and subcategories. My table looks liek this:

<b>id</b> - auto-increment
<b>act_type</b> - 0 = main category, 1 = subcategory
<b>sub_type</b> - integer. Will equal a number from the id field for the main category that it falls under.
<b>act_desc</b> - category description


An example of what I'd like the output to look like (but with bullets/sub-bullets) is:

- Artist (id=3)
- Blues Travler (sub_type=3)
- Black Crowes (sub_type=3)

- Album Title (id=4)
- Evil Empire (sub_type=4)
- USe Your Illusion (sub_type=4)

I am pretty new to PHP, but have coded in ASP in the past, so I understand logic. I'm thinking I need some kind of an array, but not sure how to incorporate it.

Any help would be much appreciated!

Reply to this topic