print hierarchy data(adjacency list model) in a list(ul/ol/li)

Posted by adi on Stack Overflow See other posts from Stack Overflow or by adi
Published on 2011-01-03T15:44:36Z Indexed on 2011/01/03 15:53 UTC
Read the original article Hit count: 221

Filed under:
|
|

I have adjacency list model like on the page http://dev.mysql.com/tech-resources/articles/hierarchical-data.html i have make a full table containing all data ordered by level using this

SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3, t4.name as lev4
FROM category AS t1
LEFT JOIN category AS t2 ON t2.parent = t1.category_id
LEFT JOIN category AS t3 ON t3.parent = t2.category_id
LEFT JOIN category AS t4 ON t4.parent = t3.category_id
WHERE t1.name = 'ELECTRONICS';
ORDER by .....

I want to make an unordered list using php from the table Anyone can help me...

© Stack Overflow or respective owner

Related posts about mysql

Related posts about tree