Hi,

I want to build a tree menu (table with categories on 3 level) from database.

I want to look like this using unsorted lists (3 levels):
Category1
-Subcategory 1
-Subcategory 2
-Sub-Subcategory 1
-Sub-Subcategory 1

Category2
-Subcategory 1
-Subcategory 2
-Subcategory 3
-Sub-Subcategory 1
-Sub-Subcategory 1
-Subcategory 4


The structure of the Category table is like this:
category_id
parent_id

So i put from database into an array():
Code:
$menu = Array();
while ($m = mysql_fetch_array($result)) {
$menu[] = Array('id'=>$m['category_id'], 'parent'=>$m['parent_id']);
}

But from here i've tried different algorithms but it does't work.


I have only 2 main categories:
category_id = 207
parent_is = 0

category_id = 286
parent_is = 0

And then sub categories and sub subcategories

Could you please help me with this?

Thank you!!