Question
2 Dimensional Arrays - Dynamic Index Problem
I cannot seem to get anything to work lately. Here is what I
need to do -
I have a 2D array - the first index will be an integer that is sequential in order. The second index will be an integer, but it will not be sequential, and will be bascially a question number.
How do you set a 2D array using dynamic variables as the indexes?
Now here is the problem. I need to set the array in a loop. The loop is an index loop, and it is as follows - (this version WORKS)
But this version DOES NOT - I get an http 500 error.
And as a sidenote - How can I force my applications to give the debug information. Working at home - I get no debug info - just 500 errors, at work, I sometimes get an error message - but not all the time. the debugging info is helpful.
I have a 2D array - the first index will be an integer that is sequential in order. The second index will be an integer, but it will not be sequential, and will be bascially a question number.
How do you set a 2D array using dynamic variables as the indexes?
Now here is the problem. I need to set the array in a loop. The loop is an index loop, and it is as follows - (this version WORKS)
quote:
<cfset answerArray = ArrayNew(1)>
<cfset i = 1>
<cfloop index="x" list="#form.fieldnames#">
<cfset tempstr = #x#>
<cfset newIndex = #removeChars(tempstr,1,9)#>
<cfset answerArray[#i#] = "#form#">
<cfset i = #i#+1>
<cfoutput>#form#<br></cfoutput>
</cfloop>
But this version DOES NOT - I get an http 500 error.
quote:
<cfset answerArray = ArrayNew(2)>
<cfset i = 1>
<cfloop index="x" list="#form.fieldnames#">
<cfset tempstr = #x#>
<cfset newIndex = #removeChars(tempstr,1,9)#>
<cfset answerArray[#i#] [#newIndex#] = "#form#">
<cfset i = #i#+1>
<cfoutput>#form#<br></cfoutput>
</cfloop>
And as a sidenote - How can I force my applications to give the debug information. Working at home - I get no debug info - just 500 errors, at work, I sometimes get an error message - but not all the time. the debugging info is helpful.
