Hi, how to make a category tree in php? Recently I've a table called 'category' and inside containt ID,Name,ParentID.

Please give me a simple example code to do it. Very appreciated if you could help me to solve this problem.

To display category and subcategory in <tr> and </tr> format if possible.

Order your table by parentId, then recurse through the items. The ones without a parent you show in a loop, in every loop, check if there are any children.

Can you provide some php code for me to reference? ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.