<% ' version 4.May 7,2545 %>
<!--#include file="header.asp"-->
<%
dim yourscore, yourans, youdo, youdodiv
yourscore = 0
youdo = 0
response.write("<ol><font color=blue><b>ผลการเฉลยข้อสอบ</b></font>")
for j = 1 to request.form("tot")
i = request.form("num"&j)
yourans = cint(request.form("a"&i) / 13 / request.form("qid"&i))
response.write("<li>คำถาม :: "& request.form("ques"&i) &"<br>คำตอบ :: <font color=#800000>"& request.form("ans"& yourans &"x"&i) & "</font>")
if cint(request.form("q"&i)) > 0 then
if yourans = cint(request.form("q"&i)) then
yourscore = yourscore + 1
end if
youdo = youdo + 1
end if
next
response.write("</ol><center>")
response.write("<table width=90% bgcolor=red><td><font color=white size=6>")
response.write("<center>ท่านได้คะแนน : "& yourscore & "<br>")
response.write("จำนวนข้อสอบที่ท่านทำ : "& youdo & "<br>")
youdodiv = youdo
if youdo = 0 then
youdodiv = 1
end if
response.write("คิดเป็น % ของที่ทำได้ : "& yourscore / youdodiv * 100 & "<br>")
response.write("จำนวนข้อสอบทั้งหมด : "& request.form("tot") & "<br>")
response.write("</td></table>")
if youdo > 0 then
%><!--#include file="connectdatabase.asp"-->
<%
if session("mu") <> "guest" and len(session("mu")) > 0 then
sql = "select * from signin where intime= #" & session("intime") & "# and mu= '" & session("mu") &"'"
set rs = server.createobject("ADODB.recordset")
rs.open sql,connect,1,3
tots = rs.recordcount
response.write(tots)
sql = "update signin set usequiz ="& rs("usequiz") + yourscore &" where intime=#" & session("intime") & "# and mu = '"& session("mu")&"'"
connect.execute(sql)
end if
%>
<!--#include file="connectsubj.asp"--><%
sql = "insert into eval(edate,mu,selectscore,rightscore,quiztype) values ('" & now
sql = sql & "','"& session("mu") &"',"& youdo &","& yourscore &",'"& request.form("tot") &"')"
connect.execute(sql)
response.write("<br>ข้อมูลเหล่านี้ถูกจัดเก็บเข้าฐานข้อมูลแล้ว")
end if
response.write("<br><a href=default.asp>คลิ๊กที่นี่</a> :: เพื่อกลับสู่หน้าแรก")
set rs = nothing
set connect = nothing
%>
<!--#include file="footer.asp"-->
จำนวน : 53 บรรทัด