Page 1 of 1

display child filed

Posted: Sun Oct 08, 2006 7:19 pm
by Think Pink
Hello,
I have a question about displaying a table in a recursive way. Not shure if I express my self corectly so sorry for that and for my bad english, but I hope you will understand

for example I have the folloeing table:

[table]
id int(5) auto_increment
category_name varchar(15)
parent_id int(5)

and this is tha data it contains
1 | Top category | 0
2 | Cars | 1
3 | Old cars | 2
4 | New cars | 2
5 | Computers | 1
6 | Used computers | 5
7 | Used Monitors | 6


This should be displayed like this in html
Cars
> Old cars
> New cars
Computers
> Used Computers
>> Used monitors

Any ideeas how could I do that?
Thx

Posted: Mon Oct 09, 2006 1:57 am
by Rovas
Look at these pages
how to create the array in which you' ll put the categories and subcategories
http://www.phpwebcommerce.com/source/li ... ctions.php
how to display them on the page
http://www.phpwebcommerce.com/shop-browse-category.php
Good luck!

Posted: Mon Oct 09, 2006 6:51 am
by Think Pink
thank you. I'll take a look