I'm trying to build a category/subcategory class with php & MySQL.
I am stuck with the following problem:I want to make a selection of all categories in an ordered way like it's showed in the picture below. The table structure I've made is:
Can I build an SELECT * statement which will select these categories in that order?
You need to index your tree. There are multiple means to do so, explained in Managing Hierarchical Data in MySQL.
精彩评论