...

View Full Version : How to parse hierarchical data!



Glass Casket
08-29-2007, 05:25 PM
I read http://www.sitepoint.com/article/hierarchical-data-database and had a few questions. I tried posting on the SitePoint forums but got nothing.

I have the following structure:

HTML Code:


- TB
- cat a
- cat b
- sub-cat b
- sub-cat b
- sub-cat b
- cat c

My table structure is 'category_id, name, lft, rgt'.

The category_id is linked in with my items table. And items can be associated with categories or sub-categories.

Any ideas how I can display my products in the following fashion:

HTML Code:


- TB
- cat a
- product from sub category a
- cat b
- sub-cat bb
- product from sub category b
- sub-cat bbb
- product from sub category bbb
- product from sub category bbb
- sub-cat bbbb
- cat c
- product from sub category c

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum