Maybe this is an easy one but I'm stumped and need help.

I have a query that returns among other things
a question_id, score

I'm trying to display a test that has already been taken with the answers.
The DB looks fine however I know the problem lies in my CF output.

Here's output from the query..
question_id     score           comment
529                1                  N/A
531                0                  False
533                -1                 N/A

when outputting the query and setting the values this is that I have.

<cfif display.question neq "">
<cfset cnt = 1>
<cfoutput>
<cfif cnt mod 2 eq 0>
<cfset cls = "tpstep">
<cfelse>
<cfset cls="tpstep2">
</cfif>
<tr id="tr_#rc#_#cnt#" style="display:none;">
<td class="#cls#">&nbsp;&nbsp;&nbsp;&nbsp;#cnt#&nbsp;#display.question#</td>
<td class="#cls#" align="center" nowrap>
<cfif display.question_type_id eq 1>
&nbsp;
<cfelseif display.question_type_id eq 2>
<input type="radio" name="qid_#display.question_id#" value="1"
<cfif display.score[display.question_id] eq 1>checked</cfif>> Pass
<input type="radio" name="qid_#display.question_id#" value="0" <cfif
display.score[display.question_id] eq 0>checked</cfif>>Fail <input
type="radio" name="qid_#display.question_id#" value="-1" <cfif
display.score[display.question_id] eq -1>checked</cfif>>NA
<cfelse>
Completed:<br> <input type="radio"
name="qid_#display.question_id#" value="1" <cfif
display.score[display.question_id] eq 1>checked</cfif>> Yes <input
type="radio" name="qid_#display.question_id#" value="0" <cfif
display.score[display.question_id] eq 0>checked</cfif>>No
</cfif>
</td>
<td class="#cls#"><textarea name="cid_#display.question_id#"
rows="3" cols="25">#display.note[display.question_id]#</textarea>
</tr>
<cfset cnt = cnt + 1>
</cfoutput>

</cfif>
<cfset rc = rc + 1>
</cfoutput>

But this inst correct.. I believe it's because that QueryArray starts
at 1 and goes to the amount of the values returned. So
display.score[529] wouldnt return anything because there's not 529
values in the array.
Right?
So how do I get around that?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to