<%
'Request all values
ID=CInt(trim(request.QueryString("ID")))
Answer=CInt(trim(request.QueryString("Answer")))
userAnswer=CInt(trim(request.QueryString("userAnswer")))
Total = CInt(trim(request.QueryString("Total")))
Times = CInt(trim(request.QueryString("Times")))
'Set all initial value
if Answer <> userAnswer And Times < 1 then ID = ID -1 'Make sure questino didin't move forward if the answer is wrong
'Open a DB Connection
set conn=Server.CreateObject("ADODB.Connection")
conn.open "DSN=dotcom"
SQL="SELECT * FROM tbThanksGivingGame where ID= " & ID & " order by ID"
set rs=conn.execute(SQL)
if times < 2 and ID >1 then ID = ID -1 ' display previous question answer
lastSQL="SELECT strCorResponse,strIncorResponse1,strIncorResponse2 FROM tbThanksGivingGame where ID= " & ID
set lastRs=conn.execute(lastSQL)
'Set the first Message
If Answer = 0 and userAnswer= 0 then
msg="
Ready? Here is your first question:"
'Set correct answer message
elseIf Answer = userAnswer then
msg=lastRs("strCorResponse")
Total=Total+1
Times = 0
'set incorrect message for first and second time
elseIf Answer <> userAnswer then
Times=Times+1
if Times=1 then
msg="
" & lastRs("strIncorResponse1") & ""
elseif Times = 2 then
msg="
Sorry. Here's the answer. " &lastRs("strIncorResponse2")
Times = 0
end if
end if
'Display the question
If not rs.EOF then
response.write ("