need help!
here's my setup: i have table with three fields:
categories table :
cat_id (unique id)
cat_name (descriptive name)
cat_parent (shows if this is a subcategory. if cat_parent = 0, then it is a top category, if cat_parent > 0, then it is a subcategory of cat_parent (w/c is the id of another category))
example:
id name parent
1 cat1 0 (this is a top category)
2 cat2 0
3 cat3 0
4 cat4 1 (subcategory of cat1)
5 cat5 1
6 cat6 1
7 cat7 6 (subcategory of cat6)
and so on.
now the problem:
how can i display all the categories and sub-cats in html. i want to list it in this format (must show the parent category):
cat1 -> cat4
cat1 -> cat5
cat1 -> cat6 -> cat7 -> cat8
cat2 -> cat9 -> cat 10
cat3 ->
should i use mysql_fetch_array to display the tree?
thnx in advance for any help