How to make a dynamic tree structure menu

To make dynamic tree structure menu, We have to make to functions one is for “Parent Menu” and second for “Child Menu or Sub Child Menu”. $query = “select * from categories where parentid=’0′”;...