Skip to main content
Inspiring
May 4, 2010
Question

Need help linking from static page to db record

  • May 4, 2010
  • 2 replies
  • 1109 views

I'm having trouble linking from an ordinary <a href="description.cfm?recordid=A51">Select</a> link to an action page with an SQL query of

select * from classes where recordid="....." I don't know what to put in here.

I've tried '#rsClasses.recordid#' but that just gives me the first record in the database. What I want to bring in is the A25 that I've identified in the link. I have about 30 links I'd like to identify myself rather than do a database search for them. In an order version of Dreamweaver I was able to make that static link connection using a parameter like: <cfparam name="rsOperas_TM_progid" default="#progid#"> with a query of <cfquery name="rsOperas" datasource="#MM-cnOne_DSN#"> SELECT * from operas WHERE progid = #rsOperas_TM_progid# </cfquery> Everything worked fine then but I can't get it to work with my new page. What should I be putting in my original select statement? I can't just use URL.recordid because I don't want to do a search. I want to link directly.

Thanks.

    This topic has been closed for replies.

    2 replies

    tharringAuthor
    Inspiring
    May 4, 2010

    I changed my setup to:

    <cfquery name="rsClass2" datasource="Holly" >

    SELECT recordid, sortorder, classname FROM classes

    WHERE recordid = #url.recordID#

    <cfqueryparam value="#url.recordID#">

    </cfqueryparam>

    </cfquery>

    about a dozen different ways and NOW I get....

    SELECT recordid, sortorder, classname FROM classes WHERE recordid = A51  (param 1)

    as an error.

    Any ideas?

    Thanks.

    tharringAuthor
    Inspiring
    May 4, 2010

    Also, the recordid field isn't an integer. It's a text (string) field. There is a different field for the actual id field for the table. Hope that helps.

    Thanks again.

    tharringAuthor
    Inspiring
    May 4, 2010

    Yes, I did get an error message that the <cfqueryparam> needed a closing tag. And it asked to be nestled within the <cfquery> tag. That's why after about 20 tries I set it up that way.

    What I'm still having problems with is getting the correct record to show up. I've identified which recordid I want (a regular column) in my link , but I'm still not getting that specific record using this:

    SELECT recordid, sortorder, classname FROM classes

    WHERE recordid = #url.recordID#

    <cfqueryparam value="#url.recordID#">

    </cfqueryparam>

    </cfquery>

    Why would CF return "WHERE recordid = A51 (param 1)?

    Is it expecting more params?

    It has the param I want. Why won't it return that record?

    Thanks


    ilssac
    Inspiring
    May 4, 2010

    #url.recordID#

    <cfqueryparam value="#url.recordID#" cfsqltype="cf_sql_intenger"> would be even better.