So the final menu will look something like this:
Item B
Item B-1
Item B-1-2
Item B-1-1
Item A
SubItem A-1
SubItem A-2
Item C
Based on the following DB records:
id menu_title parent_menu_id menu_level weight
1 Item A 0 1 1
2 Item B 0 1 0
3 Item C 0 1 2
4 SubItem A-2 1 2 1
5 Item B-1 2 2 0
6 Item B-1-1 5 3 1
7 SubItem A-1 1 2 0
8 Item B-1-2 5 3 0
How would I go about displaying? My guess is it'll involve storing all the items into a multidimensional array, then looping through it somehow...
解决方案
Dealing with the data structure as you have it will often involve recursion or multiple queries to build the tree.
Have you considered other ways of storing a hierarchy? Check out modified pre-order traversal - here's a nice PHP based article about this.