Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/07/2005, 09:44
roroland
 
Fecha de Ingreso: enero-2002
Ubicación: Mar del Plata
Mensajes: 243
Antigüedad: 23 años, 4 meses
Puntos: 0
Gracias Saruman....
La verdad es que es algo avanzado para mi esto, logre adaptar una encuesta que arme desde un tutorial...Esta tengo alojada aqui a modo de ejemplo:
votar

Vota y mira como presenta los resultados...

Todo bien hasta ahi, el tema es que no me interesa mostrar los porcentajes sino el orden de mayor a menor, o sea un ranking....El mas votado arriba de todo, el 2do debajo, etc, etc...
Y pese a que entiendo tu razonamiento yo en esto de la programacion no soy bueno, quiero aprender pero no se resolver esto. Ni empezar
Te adjunto el codigo fuente que utilice en este ejemplo, en la pagina de resultados:

"<%
Dim rs_poll
Dim rs_poll_numRows

Set rs_poll = Server.CreateObject("ADODB.Recordset")
rs_poll.ActiveConnection = MM_mxpoll_STRING
rs_poll.Source = "SELECT * FROM mxpoll"
rs_poll.CursorType = 0
rs_poll.CursorLocation = 2
rs_poll.LockType = 1
rs_poll.Open()

rs_poll_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rs_poll_total
Dim rs_poll_first
Dim rs_poll_last

' set the record count
rs_poll_total = rs_poll.RecordCount

' set the number of rows displayed on this page
If (rs_poll_numRows < 0) Then
rs_poll_numRows = rs_poll_total
Elseif (rs_poll_numRows = 0) Then
rs_poll_numRows = 1
End If

' set the first and last displayed record
rs_poll_first = 1
rs_poll_last = rs_poll_first + rs_poll_numRows - 1

' if we have the correct record count, check the other stats
If (rs_poll_total <> -1) Then
If (rs_poll_first > rs_poll_total) Then
rs_poll_first = rs_poll_total
End If
If (rs_poll_last > rs_poll_total) Then
rs_poll_last = rs_poll_total
End If
If (rs_poll_numRows > rs_poll_total) Then
rs_poll_numRows = rs_poll_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rs_poll_total = -1) Then

' count the total records by iterating through the recordset
rs_poll_total=0
While (Not rs_poll.EOF)
rs_poll_total = rs_poll_total + 1
rs_poll.MoveNext
Wend

' reset the cursor to the beginning
If (rs_poll.CursorType > 0) Then
rs_poll.MoveFirst
Else
rs_poll.Requery
End If

' set the number of rows displayed on this page
If (rs_poll_numRows < 0 Or rs_poll_numRows > rs_poll_total) Then
rs_poll_numRows = rs_poll_total
End If

' set the first and last displayed record
rs_poll_first = 1
rs_poll_last = rs_poll_first + rs_poll_numRows - 1

If (rs_poll_first > rs_poll_total) Then
rs_poll_first = rs_poll_total
End If
If (rs_poll_last > rs_poll_total) Then
rs_poll_last = rs_poll_total
End If

End If
%>

<%
'Get Poll Results using Filter
Dim arrCount(1000)
For i = 1 to 4
FilterParam = i
rs_poll.Filter = "Choice = " & FilterParam
'Count results
While NOT rs_poll.EOF
arrCount(i) = arrCount(i) + 1
rs_poll.MoveNext()
Wend
Next
%>


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#DBE8E8" text="#000066" link="#000099" vlink="#000099" alink="#000099">
<div align="center">
<p><strong><font size="4" face="Comic Sans MS">RESULTADOS</font></strong></p>
<table width="500" border="4" cellspacing="4" cellpadding="4">
<tr>
<td colspan="2"><div align="center"><strong></strong></div></td>
</tr>
<tr>
<td width="109"><strong><font size="2" face="Comic Sans MS">TEMA 1</font></strong></td>
<td width="351"><strong><font size="2" face="Comic Sans MS"><%=FormatNumber((arrCount(1)/rs_poll_total*100), 2, -2, -2, -2)%>%</font></strong></td>
</tr>
<tr>
<td><strong><font size="2" face="Comic Sans MS">TEMA 2</font></strong></td>
<td><strong><font size="2" face="Comic Sans MS"><%=FormatNumber((arrCount(2)/rs_poll_total*100), 2, -2, -2, -2)%>%</font></strong></td>
</tr>
<tr>
<td><strong><font size="2" face="Comic Sans MS">TEMA 3</font></strong></td>
<td><strong><font size="2" face="Comic Sans MS"><%=FormatNumber((arrCount(3)/rs_poll_total*100), 2, -2, -2, -2)%>%</font></strong></td>
</tr>
<tr>
<td><strong><font size="2" face="Comic Sans MS">TEMA 4</font></strong></td>
<td><strong><font size="2" face="Comic Sans MS"><%=FormatNumber((arrCount(4)/rs_poll_total*100), 2, -2, -2, -2)%>%</font></strong></td>
</tr>
<tr>
<td colspan="2"><div align="center"><font size="2" face="Comic Sans MS"><strong>UN
TOTAL DE <%=(rs_poll_total)%>VOTARON</strong></font></div></td>
</tr>
</table>
<p><strong><font size="2" face="Comic Sans MS"><a href="vote.asp">VOLVER</a></font></strong></p>
<p>&nbsp;</p>
</div>
</body>
</html>
<%
rs_poll.Close()
Set rs_poll = Nothing
%>"

Espero puedas ayudarme
Gracias