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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 RandhawaCEOCommented:
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 RandhawaCEOCommented:
i think if u share code that might help
0
SidFishesCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.