[thelist] code resend for Displaying survey results

Chris Spruck cspruck at mindspring.com
Mon Mar 19 23:30:52 CST 2001


Sorry about the previous code post. Sent as text only, but on my end at 
least, the html tags got picked up, since I forgot they were in there. Hope 
this works properly.

Chris

[CFQUERY NAME="pollquery" DATASOURCE="custservdb"]
SELECT vote, COUNT (vote) AS votecount
FROM poll
GROUP BY vote
ORDER BY vote DESC
[/CFQUERY]

[CFQUERY NAME="votetotal" DATASOURCE="custservdb"]
SELECT *
FROM poll
[/CFQUERY]

[html]
[head]
[title]Poll Results[/title]
[/head]

[body BGCOLOR="FFFFFF"]
Online Poll Results
[TABLE BORDER="0"]
[CFOUTPUT QUERY="pollquery"]
[CFSET percent = ((#pollquery.votecount# / #votetotal.RecordCount#) *100)]

[TR]
[TD WIDTH="75" ALIGN="left"]#vote#[/TD]
[TD WIDTH="175" ALIGN="left" VALIGN="bottom"][IMG SRC = 
"intranet/art/percentbar.gif" WIDTH = "#percent#" HEIGHT = "12" ALIGN = 
"middle"] #NumberFormat(percent, "-999.9")#%[/TD]
[TD WIDTH="100"]#pollquery.votecount# votes[/TD]
[/TR]
[/CFOUTPUT]

[TR]
[TD COLSPAN="2"] [/TD]
[TD ALIGN="left"]
[CFOUTPUT]#votetotal.RecordCount# total[/CFOUTPUT]
[/TD]
[/TR]

[/TABLE]
[/BODY]
[/HTML]





More information about the thelist mailing list