hi i am using codeigniter
. i have a table like this .
PreferenceID | PreferencParentID | Value
1 | 0 | Fashion
2 | 0 | music
3 | 1 | Men's fashion
4 | 1 | Women's fashion
5 | 2 | Rock music
6 | 3 | shirts
if i passed PreferenceID = 1
i want to get records Fashion,Men's fashion,Women's fashion,shirts
and if i passed PreferenceID = 2
i want to get records music ,Rock music
.
- i want to get all the child values in all levels when i pass a parent id .
here if i passed
PreferenceID = 1
it isFashoin
, it has two childs ,Men's fashion
andWomen's fashion
.and men's fashion
is the parent value ofshirts
.
this is the hierarchy . it is like a tree structure , and goes to N levels , please help me
currently i am doing is passing prefernceID
and get all next level childs ,
ex :- i am passing prefernceID = 1
and getting only Men's fashion
and Women's fashion
:(
please help . thanks in advance