I was wondering how would I display my hierarchical data to create my categories and endless sub categories using PHP & MySQL?
A quick example of how my PHP & MySQL code should look like would help out a lot.
MySQL table categories structure
id parent_id category
1 0 a & w
2 0 b & f
3 1 c & sometimes y
4 1 d
Of course it’s possible. This code will render a
<ul> <li>hierarchical tree, regardless of number of levelsThe resulting HTML for your example will be:
That will render in a browser like this:
I repeat, this works for any level of nesting.
Hope this helps.