Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

marcelocardoso

Porcentagem em ENQUETE?

Recommended Posts

Olá GALERA!

 

Há alguns dias consegui este código nao me lembro aonde na internet, e está funcionando normalmente... mas andei pesquisando e vendo enquetes por aí (porque até entao nao conhecia muito bem enquetes) e percebi que elas tem porcentagem de VOTAÇÃO, mas esta que consegui ela faz tudo menos isso. ok

 

Portanto estarei POSTANDO a parte do código que consegui que faz a parte da VOTAÇAO e MOSTRA AS ESTATISTICAS. ok

 

Mas se notarem no código, o cara que fez já devia estar pensando em fazer a tal da porcentagem no codigo a seguir, pois ele declarou uma variavel no código chamada de nPorcent, mas acabou nao fazendo o resto.

 

Por isso gostaria de ver com amigos se me ajudam a completar este codigo postado a parte da PORCENTAGEM, pois é somente oque me falta e realmente nao sei fazer, pois já até olhei outras que tem mas não consigo adaptar.....

 

ME AJUDEM COLEGAS:

 

<%':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'INÍCIO DO SCRIPT DA ENQUETE':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  FUNCTION String_GetFullPath( strVirtualPath )		  String_GetFullPath = Server.MapPath( strVirtualPath )		  String_GetFullPath = Replace(String_GetFullPath,"/","\") END FUNCTION FUNCTION PollMentor_GetDatabaseConn()				  strDSN = "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("../dados/Enquetes.mdb")	Set oRet = Server.CreateObject ("ADODB.Connection")		oRet.Open strDSN					SET PollMentor_GetDatabaseConn = oRet END FUNCTION FUNCTION PollMentor_GetTitle()		  PollMentor_GetTitle = "Enquete"	 END FUNCTION FUNCTION PollMentor_TryToVote( sID, nNumber )	SET oConn = PollMentor_GetDatabaseConn()		IF sID = - 1 Then	SET oRS = oConn.Execute("select id from poll where active=true")		   sID = oRS("id").Value		oRS.Close	SET oRS= Nothing	End If		IF PollMentor_CanUserVote( oConn, sID ) = False Then	   sRet = "Você já votou nesta enquete. <br>Não é possível votar novamente."	ELSE	   strSQL = "update poll set count" & nNumber & " = count" & nNumber & " +1 where "	IF nNumber = - 1 Then			strSQL = strSQL & " active=true"		Else			strSQL = strSQL & " id=" & sID		End If				oConn.Execute strSQL		oConn.Execute "insert into votelog(poll_id, ip) values(" & sID & ",'" & Request.ServerVariables( "REMOTE_ADDR" ) & "')"				sRet = "Obrigado por participar."	End If		oConn.Close	SET oConn = Nothing		PollMentor_TryToVote=sRet END FUNCTION FUNCTION PollMentor_CanUserVote( oConn, sID ) '	 sTime = DateAdd( "d", -Request.Form("time"), now() )		strSQL = "select id from votelog where poll_id=" & sID & " AND datum < #"&sTime & "# AND ip='" & Request.ServerVariables( "REMOTE_ADDR" ) & "'"		SET oRS = oConn.Execute(strSQL)		 IF oRS.EOF Then		PollMentor_CanUserVote = True		ELSE		PollMentor_CanUserVote = False	END IF				oRS.Close	SET oRS = Nothing  END FUNCTION FUNCTION PollMentor_GetPollInfo ( ByVal nID, ByRef sTitle, ByRef sQuestion, ByRef vAnswers, ByRef vCount )		SET oConn = PollMentor_GetDatabaseConn()		strSQL = "select * from poll where " 	IF nID = - 1 Then		strSQL = strSQL & " active=true"		ELSE		strSQL = strSQL & " id=" & nID	END IF		SET oRS = oConn.Execute(strSQL)	 IF oRS.EOF Then		PollMentor_GetPollInfo = False				ELSE				sTitle = PollMentor_GetTitle()				 sQuestion=oRS("question")		FOR nCount = 1 To 8			vAnswers(nCount)=oRS("answer" & CStr(nCount))			  vCount(nCount)=oRS("count" & CStr(nCount))		NEXT		PollMentor_GetPollInfo  = True		END IF			oRS.Close	SET oRS = Nothing		oConn.Close	SET oConn = NothingEND FUNCTION':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'FIM DO CÓDIGO DA ENQUETE':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::%><%'Some before doings...'Lets get the current poll...Dim sTitleDim sQuestionDim vAnswers(8)Dim vCount(8), sIDsID = Request.QueryString("id")If sID = "" Then	sID = -1End IfDim sError'Are we trying to vote?If Request.Form("R1") <> "" Then	'First try to vote...	sError = PollMentor_TryToVote(sID,Request.Form("R1") )End If'Get active one...Dim nRetnRet = PollMentor_GetPollInfo( sID, sTitle, sQuestion, vAnswers, vCount )%><HTML><HEAD>	<TITLE>Enquete</TITLE>	<link href="admanager/manager_includes/includes_config-css_2.css" rel="stylesheet" type="text/css"><BODY bgcolor="#FFFFFF" LINK="#0000FF" VLINK="#0000FF" ALINK="#0000FF"><font face="Arial, Helvetica" size="4" color="#000000"><B><%=sTitle%></B><p>  <%=sError%><P>  <form method="POST" action="enquete_estatisticas.asp">	<center>	  <TABLE width="100%" BORDER=0 CELLPADDING=2 CELLSPACING=2>		<TR>		  <TD height="30" colspan=2 align="center" BGCOLOR="#88D9D5"><table width="100%" border="0" cellspacing="2" cellpadding="2">			<tr>			  <td><font face="Arial, Helvetica" size="2" color="#FFFFFF"><b><%=sQuestion%></b></font></td>			</tr>		  </table></TD>		</TR>		<%Dim nCount, nMaxValue, nLowValue'First of all get max value and nLowValuenMaxValue = 0For nCount=1 To 8 	If vAnswers(nCount)<>"" And vCount(nCount)>nMaxValue Then		nMaxValue = vCount(nCount)	End IfNext	If nMaxValue = 0 Then		nMaxValue = 1End If	Dim nMaxWidth nMaxWidth = 200 'This is number of pixels for maxvalueDim nThisVal, nTotal, nPercentnTotal = 0For nCount=1 To 8 If vAnswers(nCount) <> "" Then	nTotal = nTotal + vCount(nCount)	nThisVal = FormatNumber(vCount(nCount) / nMaxValue * nMaxWidth,0)%>		<tr>		  <td width="50%"><%=vAnswers(nCount)%></td><td width="<%=nMaxWidth%>" align="left">  <img src="barra.gif" width="<%=nThisVal%>" height="10" ></tr>		<%	End IfNext%>	</TABLE>	  Total de votos: <%=nTotal%><br>	  <a href="java script:vejaantigas()"></a>		<input name="button" type="button" Onclick="history.back();" value="Voltar"></form>

Obrigado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Hein!!!!

 

GALERA!

Alguém pode me ajudar, pois só falta colocar ao lado das barras a PORCENTAGEM!

Sou novato em Enquetes e não sei como fazer....

 

Alguém de vocês pode me dar uma luz neste código???????

 

Obrigado e que Deus Abençoe a todos....

Muito Obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá pessoal!

 

Alguém pode me ajudar aqui?

Pois já tentei de várias maneiras mas não sei como colocar PORCENTAGEM aqui nesta enquete. pois é só oque me falta.

 

Por favor colegas, só me falta isso.

Não quero ser chato, e não estou pedindo para fazer toda a enquete, somente a % ok.

 

Me ajudem.....

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pessoal!

 

Aguardo nem que seje um NÃO como resposta!

Mas por gentileza alguém se manifesta por favor....

 

Alguém que seje mais experiente em enquetes ok, pois eu sei que tem FERAS aqui no fórum que podem me ajudar nessssssssssaaaaaaaaaaaaaaaaaaaaaa.......

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.