Cold fusion URL

I have a blog site that displays a mainCategory and a subCategory.

These two categories can build a dynamic URL once a User clicks on them.

Scenario #1
When a User clicks on a link for mainCategory the URL created is

Scenario #2
When a User clicks on a link for subCategory the URL created is

I need to know what is the best way to display the results for Scenario #2.
The results are returned from a database.

Who is Participating?
SidFishesConnect With a Mentor Commented:
ok I think I understand what you are asking

<cfset TempQry1= querynew("")>
 <cfset queryaddcolumn  (TempQry1, "brandid", "CF_SQL_integer", ListToArray("1,2,3,4"))>
<cfset queryaddcolumn  (TempQry1, "brandname", "cf_sql_varchar", ListToArray("ford,honda,gm,toyota"))>
<cfset TempQry2= querynew("")>
 <cfset queryaddcolumn  (TempQry2, "detailid", "CF_SQL_integer", ListToArray("1,2,3,4,5,6"))>
<cfset queryaddcolumn  (TempQry2, "brandid", "CF_SQL_integer", ListToArray("1,1,1,2,3,4"))>
<cfset queryaddcolumn  (TempQry2, "detaildesc", "cf_sql_varchar", ListToArray("focus,, mustang, taurus, civic,camry, prius"))>

<cfdump var="#tempqry1#">
<cfdump var="#tempqry2#">
above are runtime queries just to show example data. Assumes a one to many table relationship in your data<br><br><br>

<cfset theUrl="">
 treat the url as a list and get the last which is the brand name <br><br><br>

 query of queries are case senstive so convert url to all upper  <br><br><br>
<cfset urlLast = ucase(listlast(theUrl, "/"))>

 get the brandid from the brand query the "one" table<br>
<cfquery name="getBrand" dbtype="query">
select * from tempqry1 where upper(brandname) = '#urllast#'

<cfdump var="#getbrand#">
get the brand details based on brandid  the "many" table  <br>
<cfquery name="getBrandDetails" dbtype="query">
      select * from tempqry2 where brandid = #getbrand.brandid#

<cfdump var="#getbranddetails#">

What exactly do you mean by "I need to know what is the best way to display the results for Scenario #2."
Gurpreet Singh RandhawaWeb DeveloperCommented:
yeas, The question asked by SID same "What is the best way? [Means]"?
swaggrKAuthor Commented:
Um, not sure where the confusion is occurring, I just need to know what way would you recommend to solving the problem.

My table holds the mainCategory and subCategory outputs

And i am confused about how to create a page that would display those results even if a user
sent the page to someone and the page contained

Do you need to see the code to help?
Gurpreet Singh RandhawaWeb DeveloperCommented:
i think if u share code that might help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.