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 http://mySite.com/mainCategory/

Scenario #2
When a User clicks on a link for subCategory the URL created is http://mySite.com/mainCategory/subCategory

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

swaggrKAsked:
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="http://mySite.com/Car/Ford">
 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#'
</cfquery>

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

<cfdump var="#getbranddetails#">

0
 
SidFishesCommented:
What exactly do you mean by "I need to know what is the best way to display the results for Scenario #2."
0
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
yeas, The question asked by SID same "What is the best way? [Means]"?
0
 
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 http://mySite.com/Car/Ford

Do you need to see the code to help?
0
 
Gurpreet Singh RandhawaWeb DeveloperCommented:
i think if u share code that might help
0
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.