How to Display Category tree wise using PHP

in this example i m showing you how to display category in tree wise till n-level using recursive function and show you how to display in select box. this code is not for category you can use anywhere wherever you meet your criteria.  for more detail view below code and test in your website.

Table:category

ID Category ParentID
1 Hobby 0
2 Cricket 1
3 Chess 1
4 Vollybol 1
5 Operating System 0
6 Windows Xp 5
7 Windows 7 5
8 Windows Vista 5

 

 

  • ChanOngpang Kuch

    $tree =Category_combo($cat_row,0,0,$parent_id); //calling recursive function here
    echo $tree;

    Error $parent_id