Skip to main content
Inspiring
May 10, 2010
Question

display list of categories and sub-categories

  • May 10, 2010
  • 1 reply
  • 434 views

table contains categories:

jewellery

cards

toys

another table contains sub-categories:

jewellery, rings

jewellery, pendants

toys, cuddly

toys, vehicles

I have a show_products.cfm page which takes a paramenter, category

eg.

show_products.cfm?category=jewellery

is it possible to list all the categories and when you get to jewellery list it's sub-categories also ?

This topic has been closed for replies.

1 reply

Inspiring
May 10, 2010

I'm trying to solve it like this, but its generating an error one query inside another

                                    <cfoutput query="getCategories">

                                        <li><span>>#getCategories.category#</span></li>

                                            <cfif #getCategories.category# EQ variables.category>

                                            <cfoutput query="getSubCategories">

                                                <li><span>#getSubCategories.name#</span></li>

                                              </cfoutput>

                                            </cfif>

                                        </cfoutput>

do I need a single query with a LEFT JOIN ?