Tree-type cyclic output, which has not been completed for several days. please refer to the database for help.
How to output
111111*121212*3232323222222222*333333**44444444***555555***werwerwer**6565656*23232323**324234234
How can a tree-like html loop be achieved by a sonclass that contains a subclass id? I will only output a layer of data that cannot be repeatedly output to such a subcategory.
Reply to discussion (solution)
You don't need a child id here. you just need a parent id. you just need to query the Child id based on classid.
With the parent id, featherclass = classid, you can get to the lower level of classid
What do you want to do ??
With the parent id, featherclass = classid, you can get to the lower level of classid
Can you write down the specific points? thank you !!
$ Class = $ this-> tclass-> get_all_class ($ this-> tbname); $ json_class = Array (); $ json_class2 = array (); foreach ($ class as $ key => $ value) {if ($ class [$ key] ['sonclass']) // if a subcategory {$ json_class [$ key] ['id'] = $ value ['classid ']; $ json_class [$ key] ['text'] = $ value ['classname']; $ son_arr = $ this-> tclass-> get_son_class ($ value ['class'], $ this-> tbname); foreach ($ son_arr as $ k => $ v) {$ json_class1 [$ k] ['id'] = $ v ['classid ']; $ json_class1 [$ k] ['text'] = $ v ['classname'];} $ json_class [$ key] ['Children '] = $ json_class1 ;}}
In this way, I can only obtain the parent and a layer of sub-classes. how can I cyclically obtain sub-classes?