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!
I'm trying to build a recursive function to build a tree-style navigation area. Right now I'm just trying to loop out the entries from their database, loading any children nodes below their respective parents. Any idea why this only lists the top level items and won't go any further?
Your control structures are not well defined so it could be it. Add curly brackets to well-define the while-loop scope for iterating over query results.
Second thing, using this kind of recursion is very inefficient due to the large number of sql queries. You are better off retrieving all rows in one query and then use PHP to build the tree structure.