<%
strPoll = "SELECT t_answers.*, t_question.* FROM t_answers INNER JOIN t_question ON t_answers.questionID = t_question.ID ORDER BY dt DESC"
strSum = "select sum(votes) AS votes from t_question"
set rs = objConn.execute(strPoll)
set rs2 = objConn.execute(strSum)
If rs.eof then
response.write "No questions!"
else
response.write rs("description")&"<br><br>"
response.write rs("question")&"<br><br>"
Do Until rs.eof
<%
proc = rs("counts")/rs2("votes")*100
%>
response.write rs("answer")&" <img src=""line.gif"" width="""& proc &""" height=""3""> "& FormatPercent(rs2("votes"),1,-1) &"<br>"
response.write proc & "<br>%"
rs.movenext
loop
response.write "<br>Antal röster: "&rs2("votes")&""
End IF
%>
Frågan#1
Hej!
Bygger en s k poll... Vill nu ha hjalp med att fa ut line.gif sa den stammer overens med hur manga roster det ar i Ja te x... width:en ska alltsa vara ratt. Sen vill jag ocksa fa ut procent fran varje val, alltsa hur manga procent det ar for Ja te x.
Sa har ser koden ut just nu:
<%
strPoll = "SELECT t_answers.*, t_question.* FROM t_answers INNER JOIN t_question ON t_answers.questionID = t_question.ID ORDER BY dt DESC"
strSum = "select sum(votes) AS votes from t_question"
set rs = objConn.execute(strPoll)
set rs2 = objConn.execute(strSum)
If rs.eof then
response.write "No questions!"
else
response.write rs("description")&"<br><br>"
response.write rs("question")&"<br><br>"
Do Until rs.eof
response.write rs("answer")&" <img src=""line.gif"" width="""&rs("counts")/rs2("votes")*100&""" height=""3""> "& FormatPercent(rs2("votes"),1,-1) &"<br>"
rs.movenext
loop
response.write "<br>Antal röster: "&rs2("votes")&""
End IF
%>
