<% session("your_move") = "" strSQL = "SELECT * FROM question where first_question = 'yes' order by question_id" Set adoRec = Server.CreateObject("ADODB.Recordset") adoRec.Open strSQL,con,adOpenStatic If adoRec.EOF Then Response.Write "There are no records in the database" Response.Write "
Please check back later" Response.End Else %>
<% highlight=0 question_num = 1 'while not adoRec.EOF for i = 0 to 0 question_id = adoRec("question_id") question = adoRec("question") ' store the question_id into the session %> <% if highlight = 1 then %> <% highlight = 0 else %> <% highlight = highlight + 1 end if ' display the related answers strSQL2 = "SELECT * FROM answer where question_id = "&question_id 'Response.Write "
strSQL2 : "&strSQL2 Set adoRec2 = Server.CreateObject("ADODB.Recordset") adoRec2.Open strSQL2,con,adOpenStatic highlight2=0 while not adoRec2.EOF answer_id = adoRec2("answer_id") answer = adoRec2("answer") answer_mode = adoRec2("answer_mode") if highlight2 = 1 then %> <% highlight2 = 0 else %> <% highlight2 = highlight2 + 1 end if ' Move to the next answer record adoRec2.MoveNext wend ' Move to the next record 'adoRec.MoveNext 'question_num = question_num +1 'wend next %>
 
Question <%=question_num%> : <%=question%>
Question : <%=question%>
  <%=answer%>
  <%=answer%>

<% End If 'Reset Sever Objects Set adoRec = Nothing Set adoRec2 = Nothing %>