I've done something similar by building a multidimensional array of categories and subcats in one query and then Loop thru this with a for each to build the category structure.
Categories table looks like this CatID | ParentID | CategoryName Array is $category_menu[$ParentID][$CatID] I'm sure there's a better way, but this seems to work OK. I will email code sample later [off-list]. I would be happy to share code with others as well. olinux --- Corey Eiseman <[EMAIL PROTECTED]> wrote: > Hi folks, I've got a question hopefully someone can > shed some light on for > me. > > I'm building an online store for a client, and one > of the things he wants is > to organize his products into categories and > subcategories.. not so unusual, > but the kicker is he wants to be able to associate a > subcategory with more > than one category. > > I was thinking that I should be able to easily > serialize an array of cat_IDs > and store it, but my concern is that this will > sacrifice a great deal of > flexibility when retrieving the data. For instance > when I want to get the > subcategories in a single category, I would pretty > much have to select ALL > the rows in the subcategory table, unserialize the > category array for each > row, and then check each to see if the cat_ID is in > the array..? > > That just feels inefficient to me, and I'm almost > certain I must be > overlooking something simpler.. > > Also, I don't think I can use a SET data type > because I want to be able to > add values to the set (categories) dynamically in > the future. But maybe I'm > wrong and there is a way to do that...? > > Anyway I thought I'd throw it to those more > experienced than me before I > started coding. Anyone have any ideas? > > Thanks in advance, > > Corey Eiseman > Infinite Orange Incorporated > http://infiniteorange.com/ > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]