There are two ways that I know of the adjacency model and nested sets. adjacency model uses a table structure like category_id | parent_id | category_name so if i want to see all categories belonging to category 12 -> SELECT * FROM cat_table WHERE parent_id=12; there are a few articles out there on this. not sure where at the moment, but you know what its called now. here are some articles about the nested set model. A little more difficult but with great benefits -> http://www.dbmsmag.com/9603d06.html -> http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html -> http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci801943,00.html olinux --- Daniel Harik <lists@dharik.com> wrote: > > Hello guys > > I make following query: > > mysql> SELECT b.type, a.link AS parent_link, b.link > AS child_link FROM > bookmarks AS a, bookmarks AS b WHERE a.id = > b.parentid order by > parent_link; > > and here is result > > +--------+-------------+------------------------+ > | type | parent_link | child_link | > +--------+-------------+------------------------+ > | link | MAIN FOLDER | http://www.ee/ | > | folder | MAIN FOLDER | SUBFOLDER | > | link | MAIN FOLDER | http://www.google.com/ | > | link | SUBFOLDER | http://www.amazon.com/ | > +--------+-------------+------------------------+ > > I just can't figure out how can i produce tree style > output with php > > MAIN FOLDER -> > -> http://www.google.com/ > -> http://www.ee/ > -> SUBFOLDER > -> http://www.amazon.com/ > > > Any help would be greatly apreciated. > Have a nice day. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php