<% objConn.open SQL = "SELECT * FROM Polls WHERE Poll_ID=" & request.querystring("id") & "" set rs_Poll = objConn.Execute(SQL) SQL = "SELECT * FROM Votes WHERE Poll_ID=" & request.querystring("id") & "" set rs_Votes = objConn.Execute(SQL) Dim Scores,Votes Scores=Array(0,0,0,0,0,0) Votes=Array(0,0,0,0,0,0) TotalVotes = 0 Done = "NO" Do while not rs_Votes.EOF TotalVotes = TotalVotes+1 Votes(Int(rs_Votes.Fields("Choice"))-1) = Votes(Int(rs_Votes.Fields("Choice"))-1) + 1 rs_Votes.movenext Done = "YES" loop if Done = "YES" then For thing = 0 to 5 Scores(thing) = (100/TotalVotes) * Votes(thing) Next %> <% if rs_Poll.Fields("Num_of_Options") > 2 then %> <% end if %> <% if rs_Poll.Fields("Num_of_Options") > 3 then %> <% end if %> <% if rs_Poll.Fields("Num_of_Options") > 4 then %> <% end if %> <% if rs_Poll.Fields("Num_of_Options") > 5 then %> <% end if %>

<% = Votes(0) %> Vote(s), <% = Round(Scores(0),1) %>% of the vote

<% = Votes(1) %> Vote(s), <% = Round(Scores(1),1) %>% of the vote

<% = Votes(2) %> Vote(s), <% = Round(Scores(2),1) %>% of the vote

<% = Votes(3) %> Vote(s), <% = Round(Scores(3),1) %>% of the vote

<% = Votes(4) %> Vote(s), <% = Round(Scores(4),1) %>% of the vote

<% = Votes(5) %> Vote(s), <% = Round(Scores(5),1) %>% of the vote

<% else %>
No votes recorded
<% end if rs_Poll.close rs_Votes.close set rs_Poll=Nothing set rs_Votes=Nothing objConn.close %>

[Back]