I'm trying to do something similar to this. Our tables are remarkably similar -- except I have an added subcatagory field -- 'subof' contains the upper catagory that the subcatagory in question is located under.
This is fine at first glance -- however, I'm having problems trying to make non-convoluted code that would be able to construct a catagory tree my scripts could be able to understand. At present, if there's a subcatagory of a subcatagory of a catagory, if there's another subcat with the same name somewhere else, things get really hairy.
Anyone got a good way to construct a catagory tree?