dhimo Posted November 16, 2006 Share Posted November 16, 2006 Hello everyone. Anyone have any idea on how to list all the records from this mysql table.As you can see it has main categories and subcategories, wich are identified by parent id and how deep they go.I am using php mysql.So how can i list them where each child is listed under parent id. like a tree menu rightAny ideas anyone? Thanks in advancetbl categories---------------------------------------------------------------------| id | cat_name | parent_id | depth |---------------------------------------------------------------------| 1 | Mobiles | 0 | 0 |---------------------------------------------------------------------| 2 | Computers | 0 | 0 |---------------------------------------------------------------------| 3 | Nokia | 1 | 1 |---------------------------------------------------------------------| 4 | Motorola | 1 | 1 |-----------------------------------------------------------------------| 5 | N70 | 3 | 2 |----------------------------------------------------------------------| 6 | KRZR | 4 | 2 |----------------------------------------------------------------------| 7 | Acer | 2 | 1 |------------------------------------------------------------------------| 8 | IBM | 2 | 1 |------------------------------------------------------------------------| 9 | TravelMate | 7 | 2 |-----------------------------------------------------------------------| 10 | ThinkPad | 8 | 2 |------------------------------------------------------------------------ Link to comment Share on other sites More sharing options...
justsomeguy Posted November 17, 2006 Share Posted November 17, 2006 I already answered this in the other thread Link to comment Share on other sites More sharing options...
dhimo Posted November 17, 2006 Author Share Posted November 17, 2006 Oh, I see that you have answered in the PHP section. Didnt see it until now. I am gonne work on that and see how far I goThanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now