I'm creating a online quiz. Each question is random from a database of 15 questions. The quiz has a total of 5 questions.Each question has it's own page. quiz1.cfm, quiz2.cfm,etc..
I run a cfquery on the answer to determine is correct, but can't seem to keep a tally on number of right and wrong answers.
here's the code for adding the score(not working):
Query:
<CFQUERY datasource="quiz" NAME="getAnswer">
SELECT *
FROM quiz
WHERE ID = #form.ID# AND '#form.answer#' = '#form.correct#'
</cfquery>
<CFIF getAnswer.Recordcount IS 0>
<input type="Hidden" name="home" value="#IncrementValue(form.home)#">
<input type="Hidden" name="away" value="#form.away#">
<CFELSE>
<input type="Hidden" name="away" value="#IncrementValue(form.away)#">
<input type="Hidden" name="home" value="#form.home#">
</CFIF>
Anyone do something like this or can fix?Thanks in advance.
I run a cfquery on the answer to determine is correct, but can't seem to keep a tally on number of right and wrong answers.
here's the code for adding the score(not working):
Query:
<CFQUERY datasource="quiz" NAME="getAnswer">
SELECT *
FROM quiz
WHERE ID = #form.ID# AND '#form.answer#' = '#form.correct#'
</cfquery>
<CFIF getAnswer.Recordcount IS 0>
<input type="Hidden" name="home" value="#IncrementValue(form.home)#">
<input type="Hidden" name="away" value="#form.away#">
<CFELSE>
<input type="Hidden" name="away" value="#IncrementValue(form.away)#">
<input type="Hidden" name="home" value="#form.home#">
</CFIF>
Anyone do something like this or can fix?Thanks in advance.