View Single Post
Old 08-22-2002, 06:18 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
displaying categories and sub-categories

re: mysql

these are the fields in my "categories" table.

category_id
parent_id
category_name

i need to make a tree and display these in order. here are some examples of what is inside this table:
Code:
1  NULL  tv's
2  NULL  cameras
3  1        Big Screens
4  1        Plasmas
5  2        digital
6  2        35mm
7  5        Smart Media
i need each of the sub-categories to go under the parent categories. the idea here is to be able to have infinate sub-categories nested inside categories.

so the results of my query will order it like this:
Code:
tv's
     Big Screens
     Plasmas

cameras
     digital
          smart media
     35mm
anyone have experience with this?
sde is offline   Reply With Quote