Basically you need each record to have a parent field, that tells you what's the item's parent.
Then you load all data from your table into one big array, where the key is the parent field. Then you create a recursive function, that deals with the mentioned array, each time using a different parent.
It can get complicated, check out index.php of vBulletin to learn more. Disregard the parentlist field in the forum table as it's merely used for permissions.
|