Rostning och lite utrakning...

ASP

2 svar · 162 visningar · startad av crisse6

Medlem sedan dec. 20002 526 inlägg
Trådstart#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")&"&nbsp;<img src=""line.gif"" width="""&rs("counts")/rs2("votes")*100&""" height=""3"">&nbsp;"& FormatPercent(rs2("votes"),1,-1) &"<br>"
rs.movenext
loop
response.write "<br>Antal röster: "&rs2("votes")&""
End IF
%>
Medlem sedan mars 20015 287 inlägg
#2
<%
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
%>
Medlem sedan dec. 20002 526 inlägg
#3

Japp!

265 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
131 ms — deklarationer (db)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)
127 ms — ändringar (db)