Hey John,

You don't indicate what is not working with your code.  Assuming you are
getting a page result rather than an error page, I see that the url variable
sent in your link is called 'topics', but you are searching the database on
a different url variable called 'getTopic'.

Since you are param'ing the url variable 'getTopic' and defaulting to '1',
your resultset from the second set of code would always be topic '1'

Also, in your results page, there is a missing hash tag in your reference
link:
<a href="reference_link#"> should be <a href="#reference_link#">

Hope this helps,
William


-----Original Message-----
From: John Barrett [mailto:[email protected]] 
Sent: Sunday, June 12, 2011 12:12 AM
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:5289
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to