Hi John,

I think this should do it.  I am assuming only one page is involved.

<cfparam name="URL.getTopic" default="1">
<cfquery name="GetReferences" datasource="#REQUEST.dataSource#">
SELECT *
FROM reference
<cfif isdefined("url.getTopic") and len(url.getTopic)>
WHERE topic = <cfqueryparam value="#URL.getTopic#"
cfsqltype="CF_SQL_VARCHAR">
</cfif>
ORDER BY topic
</cfquery>

<h1><strong>References</strong></h1>
          <cfoutput query="GetReferences" group="topic" groupcasesensitive="no">
                <a href="reference.cfm?topics=#GetReferences.topic#">#topic#<br 
/><br />
          </cfoutput>




>>-----Original Message-----
>>From: John Barrett [mailto:[email protected]]
>>Sent: 12 June 2011 08:12
>>To: cf-newbie
>>Subject: url params
>>
>>
>>
>>Hi, I am trying to make a application where one page as a list(I
>>got this working, code #1), but when you click on one of the
>>links, I want it to display topic areas defined in the database.
>>Any help on this would be great.
>>thanks,
>>John
>>
>>code #1(works)
>><!--- reference.cfm --->
>><cfparam name="URL.getTopic" default="1">
>><cfquery name="GetReferences" datasource="#REQUEST.dataSource#">
>>SELECT *
>>FROM reference
>>ORDER BY topic
>></cfquery>
>>
>>
>><h1><strong>References</strong></h1>
>>        <cfoutput query="GetReferences" group="topic"
>>groupcasesensitive="no">
>>              <a
>>href="reference.cfm?topics=#GetReferences.topic#">#topic#<br /><br />
>>        </cfoutput>
>>
>>code #2 (Does Not Work)
>><!--- reference_action.cfm --->
>><cfparam name="URL.getTopic" default="1">
>><cfquery name="GetReferences" datasource="#REQUEST.dataSource#">
>>    SELECT *
>>    FROM reference
>>    WHERE topic = <cfqueryparam value="#URL.getTopic#"
>>cfsqltype="CF_SQL_VARCHAR">
>></cfquery>
>>
>>
>>
>>        <h1><strong>Topics</strong></h1>
>>        <cfloop query="GetReferences">
>>              <cfoutput>
>>            #reference# <br />
>>            <a href="reference_link#">#reference_link#</a> <br /><br />
>>        </cfoutput>
>>        <hr>
>>      </cfloop>
>>
>>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5288
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to