Hey all I have a "category" table in a MySQL database for an online shop, in which one of the fields is "parent". So the structure of categories is hierarchical. CATEGORY TABLE: categoryID parentID category_name Using PHP, I want to display the category hierarchy as shown below - is there a simple way of doing this? Some kind of MySQL join, or just a simple loop of sorts? Clothes Jackets Shirts Casual Formal Jeans Underwear Accessories Watches Jewellery Rings Necklaces Belts Thanks for your time
well, tree manipulation is always tricky in MySQL. Do share table structure and a sample data with us to figure out best way out of it. Ideally storing a complete lineage in one column saves multiple querying else repeated queries can kill server at times. If categories are not added / modified daily, use a script to generate html once and use it for whole day