program | Online result.asp
The main purpose of this page is to display the results and insert the results into the database for future reference.
For each item in Request.Form
Sql_check = "Select Count (*) from" &subject& "where answer = '" & Request.Form (item) & ""
Set Rs_check = Application ("Conn"). Execute (Sql_check)
If Rs_check (0) > 0 Then
result = result + 1
End If
Next
The results are stored in the variable result.
Percentages are calculated from result, as follows:
Percent = Round ((* result)/count)
To store this result in a database, execute the following query:
sql_id = "SELECT id from Loginuser where username= '" & Session ("username") & "'"
Set rs_id = Application ("Conn"). Execute (sql_id)
Id= rs_id (0)
Sql_insert = "INSERT into details (Ref_id,subject,score) VALUES ('" & ID & "', '" _
& Subject & "', '" & Percent & ""
Set Rs_insert = Application ("Conn"). Execute (Sql_insert)
View.asp
Watch the module to check if the member has conducted an online exam before. If so, the user is directed to viewrecord.asp. If not, display the appropriate information.
sql_id= "SELECT ID from Loginuser where username= '" & Session ("username") & ""
Set rs_id = Application ("Conn"). Execute (sql_id)
Id= rs_id (0)
Sql_count = "SELECT count (*) from details where ref_id = '" & ID & "'"
Set Rs_count = Application ("Conn"). Execute (Sql_count)
If rs_count (0) < > 0 Then
Response.Redirect "Viewrecord.asp"
End If
If rs_count (0) = 0 Then
Session ("Noview") = "NO ONLINE examinations HAVE BEEN GIVEN"
Response.Redirect "Default.asp"
End If
Viewrecord.asp
The Viewrecord.asp page allows members to view some of their detail information. The query is as follows:
sql_details = "Select *subject, score from details where ref_id = '" & ID & "'"
Set rs_details = Application ("Conn"). Execute (Sql_details)
The result is displayed in a simple tabular format.
Please note that I do not limit the number of times a member can conduct a subject to a test. The same subject examination can be carried out at any time.