|
|
QUICK QUIZ
<%
if Request.Form.Count > 0 then
oRS.Open "SELECT id, correct FROM UBG_QuizQuestions WHERE quizid=" & int(Request.QueryString("id")), oConn, 0, 1, 1
correct = 0
total = 0
do while not oRS.EOF
if oRS("correct") = Request.Form("q_" & oRS("id")) then
correct = correct + 1
end if
total = total + 1
oRS.MoveNext
loop
if correct = total then
%>
Well done!
You got all <%=total%> correct!
<%
else
%>
You got <%=correct%> out of <%=total%> correct!
Would you like to try again?
<%
end if
else
sqlStr = "SELECT quizid, id, rank, question, answer_a, answer_b, answer_c FROM UBG_QuizQuestions WHERE quizid=" &_
"(SELECT TOP 1 id FROM UBG_Quiz WHERE dtgstart<=getdate() ORDER BY dtgstart DESC) ORDER BY rank"
oRS.Open sqlStr, oConn, 0, 1, 1
%>
<%end if%>
|