Best Way to get the category subcategory listing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
goyaldeepti
Forum Newbie
Posts: 5
Joined: Sun Nov 21, 2010 6:13 am

Best Way to get the category subcategory listing

Post by goyaldeepti »

Best Way to get the category subcategory listing that can have n level relation. :?: :?:
like if there is category like
a->b->c->d
->e->f->g
->h
->i->j->k
->l

Where a is main category and rest are subcategories. this reletion is comming from database.
id name parent
1 a 0
2 b 1
3 e 1
4 i 1
5 c 2
6 f 3
7 h 3
8 j 4
9 d 5
10 g 6
11 k 4
12 l 4

I have to show this relation in a drop down in a very descriptive way so as a user comes to know parent child relation from this so that if he/she wants to add a subcategory under any level he can add it easily.

hey my explanation is not too good so please try to understand what i want to say. :?
Post Reply