Odd question… My application (coldfusion8/MySQL 5.0.88) runs fine except when a user tries to access it using IE6. This throws the following error:
Element PL_SELLERS is undefined in VARIABLES
I’m having trouble reproducing, as it all browsers I can test (IE8 including) do not throw this error.
I know the problem is in the following snippet:
<cfif Session.reload_user EQ "true" OR ( Len(Session.pricelists) EQ 0 OR Len(Session.pl_sellers) EQ 0)>
<cfquery datasource="#Session.datasource#" name="q_preislisten">
... query ...
</cfquery>
<cfif q_preislisten.recordcount NEQ 0>
<cfset variables.pl_sellers = "">
<cfloop query="q_preislisten">
<cfset variables.pl_sellers = variables.pl_sellers & q_preislisten.iln_verkaeufer & ',';>
</cfloop>
</cfif>
<cfif len(variables.pl_sellers) NEQ 0 )>
<cfset variables.pl_sellers = Left(variables.pl_sellers, len(variables.pl_sellers)-1)>
<cfset Session.pl_sellers = variables.pl_sellers>
<cfset Session.reload_user = "false">
</cfif>
<cfelse>
<cfset variables.pl_sellers = Session.pl_sellers>
</cfif>
So my question:
Under what circumstances can variables.pl_sellers be undefined?
I will move the inital declaration <cfset variables.pl_sellers = ""> outside of the whole if statement, so it will always be at least an empty string. Another reason I can think of the check for len(variables.pl_sellers) being outside of the recordcount-if statement. Are there any other things I’m missing?
Thanks!
If your
preislisten.recordcount is 0, then when it checks the next IF block it’ll be undefined.