recordset self join
Hey there I wondered if you could give me some pointers on defining a mysqli self join recordset?
I believe this may help me solve my long issue on coding a website navigation.
I have 3 tables.
1. products (I may store a CategoryParentID here as well if it helps coding logic)
2. categories (This stores both parent categories AND child categories in the field CategoryParentID and CategoryID (auto increment)
3. catalog (this stores ProductID and CategoryID (and possibly CategoryParentID if needed)
NOTE: for the categories table I am also storing CategoryTopMenu (either 1 or NULL) this allows the category to be placed as a top level category. I didnt use CategoryParentID for this because it limits me in what I want to do) - I want the client to be able to create (show/hide) top level categories in the menu bar) Some of these top level categories will have child categories but others may just navigate to the category listing page.
If there is a parent category that includes child categories then I want the customer to click on the initial link that will display ALL products for the parent category, or the customer can hover over a child category.
I think I maybe close to a solution if I create a self join on the above tables in some way so that I can loop the parent records and then in the menu code, i can loop any child records.
here is the structure of the menu code in basic form:
<li <a href="../category.php?Department=&Category=">ChildCategory</a> </li>
So for the above menu structure (knowing that the one table contains parent and child records it would make sense to use a self join sql query right?