Skip to main content
Known Participant
May 4, 2016
Question

Coldfusion 2016

  • May 4, 2016
  • 2 replies
  • 1784 views

I am running a Coldfusion application for over 10 years and just upgraded to coldfusion 2016.  Now I am getting strange results.  I have a query that uses values from another query and it says the first query is not defined.  I can get it to work sometimes if I do a cfoutput first but not always.  Also, if I print a value from the first query multilple times, the first time in may be blank and the second time it returns the value.  If I do it 4 times, every other output is correct.  This only starting happening with the latest release.

    This topic has been closed for replies.

    2 replies

    Known Participant
    May 4, 2016

    Below is the query and the output.  However, just running this query by itself will work.  It's when you have it as part of a larger file.  I have simular errors in other places that work it I put the <cfoutput></cfoutput> near the code that errors.  This fixes it sometimes but not all.  I should not have to do this.  The code worked great in Coldfusion11 and just stopped when I upgraded to Coldfusion12.

    <cfquery name="getHazUserInfo" datasource="#Application.DSN#">

    SELECT *

    FROM tblusers

    WHERE ID = <cfqueryparam value="#ID#" cfsqltype="CF_SQL_INTEGER">

    </cfquery>

      <cfdump var="#getHazUserInfo#" expand="no">

    <cfoutput>FirstName1: #getHazUserInfo.FirstName#</cfoutput><br/>

    <cfoutput>FirstName2: #getHazUserInfo.FirstName#</cfoutput><br/>

    <cfoutput>FirstName3: #getHazUserInfo.FirstName#</cfoutput><br/>

    Output

    Carl Von Stetten
    Legend
    May 4, 2016

    Are the three lines of code following the <cfdump> contrived, or real?  Without referencing the row number, each of those <cfoutput>...#getHazUserInfo.FirstName#</cfoutput> calls should be returning the exact same results (the first row of the query).

    And just to rule it out, you don't have another variable/query in another scope that's named "getHazUserInfo"?

    Known Participant
    May 4, 2016

    No I was trying to show that even if I print the same 3 exact lines, expecting to see the same output, I am not.  And not the query is unique.  I've made a new example that I can put in full that works under coldfusion11 but not 2016.  I think the problem is that if I write a query then use: <cfoutput query=queryname> this causes a problem that should not.  Here is the code:

    <table cellpadding="0" cellspacing="0" border="0">

      <tr>

      <td valign="top"><br/>

        <cfquery name="getHazUserInfo" datasource="#Application.DSN#">

       SELECT *

       FROM tblusers

       WHERE ID = 872

      </cfquery>

      <cfdump var="#getHazUserInfo#" expand="no">

      <cfoutput>getHazUserInfo1: #getHazUserInfo.ID#</cfoutput><br/>

      <cfoutput query="getHazUserInfo">

       <cfoutput>getHazUserInfo2: #getHazUserInfo.ID#</cfoutput><br/>

          <cfquery name="getHazUserSys" datasource="#Application.DSN#">

            select * from hazusersys

            WHERE HazUserSys.ID = <cfqueryparam value="#getHazUserInfo.ID#" cfsqltype="CF_SQL_INTEGER">

          </cfquery>

          <cfdump var="#getHazUserSys#" expand="no">

        </cfoutput>

        </td>

      </tr>

    </table>

    Carl Von Stetten
    Legend
    May 4, 2016

    You're going to have to provide more details for anyone to try to assist you.  Can you provide the code for the queries in question?  And if the queries are inside a function, the whole function.  It sounds like the code might be doing some stuff asynchronously, but it's hard to tell how without some code to look at.