scouse
04-26-2006, 05:04 PM
Hi,
I can't get my head around how to do this and wondered if someone could point me in the right direction.
I have an SQL database that stores all the products for a website and stores the following information.
PRODUCT_CATEGORY
PRODUCT_SUBCAT
PRODUCT_NAME
PRODUCT_CATEGORY and PRODUCT_NAME will always have values assigned to them and PRODUCT_SUBCAT is optional but if used will always be one of three possible values (paper, polythene, various).
So two typical examples of data would be
PRODUCT_CATEGORY = "Bags"
PRODUCT_SUBCAT = "Paper"
PRODUCT_NAME = "White Plastic Bags"
or
PRODUCT_CATEGORY = "Boxes"
PRODUCT_SUBCAT = ""
PRODUCT_NAME = "Brown cardboard box"
I need to read these into nested lists in order to create a series of drop down menus on my website. The layout will be like this:
<UL>
<LI>BAGS
<UL>
<LI>Paper
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
<LI>Polythene
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
<LI>Various
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
</UL>
</LI>
<LI>Boxes
<UL>
<LI>Brown Cardboard Box</LI>
<LI>Brown Cardboard Box2</LI>
<LI>Brown Cardboard Box3</LI>
</UL>
</LI>
</UL>
I've managed to figure out the code to retrieve all the info from the database and group it into its relevent categories, but I can't get my head around how to get it to populate the nested lists properly. I can post the code I've done to get it to group into its relevent categories if its helpful.
I appreciate any help anyone can give me on this.
Cheers
I can't get my head around how to do this and wondered if someone could point me in the right direction.
I have an SQL database that stores all the products for a website and stores the following information.
PRODUCT_CATEGORY
PRODUCT_SUBCAT
PRODUCT_NAME
PRODUCT_CATEGORY and PRODUCT_NAME will always have values assigned to them and PRODUCT_SUBCAT is optional but if used will always be one of three possible values (paper, polythene, various).
So two typical examples of data would be
PRODUCT_CATEGORY = "Bags"
PRODUCT_SUBCAT = "Paper"
PRODUCT_NAME = "White Plastic Bags"
or
PRODUCT_CATEGORY = "Boxes"
PRODUCT_SUBCAT = ""
PRODUCT_NAME = "Brown cardboard box"
I need to read these into nested lists in order to create a series of drop down menus on my website. The layout will be like this:
<UL>
<LI>BAGS
<UL>
<LI>Paper
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
<LI>Polythene
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
<LI>Various
<UL>
<LI>White Plastic Bags</LI>
<LI>Another Plastic Bag</LI>
<LI>Another Plastic Bag 2</LI>
</UL>
</LI>
</UL>
</LI>
<LI>Boxes
<UL>
<LI>Brown Cardboard Box</LI>
<LI>Brown Cardboard Box2</LI>
<LI>Brown Cardboard Box3</LI>
</UL>
</LI>
</UL>
I've managed to figure out the code to retrieve all the info from the database and group it into its relevent categories, but I can't get my head around how to get it to populate the nested lists properly. I can post the code I've done to get it to group into its relevent categories if its helpful.
I appreciate any help anyone can give me on this.
Cheers