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.
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.
Jump to Postsimple example code to do it.
Simple example to do what exactly?
Jump to PostOrder 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.
simple example code to do it.
Simple example to do what exactly?
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? ?
I could, but I suggest you try first. Much better way to learn.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.