Home | Advertising Info7 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Thursday, April 18, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Scripting
 PowerASP Code Help Area : Classic ASP - Scripting
Subject Info: ASP - Counting votes A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
shadowspell
Newbie
Newbie
Avatar

Joined: May/04/2004
Location: United States
Online Status: Offline
Info: 13
Added: June/17/2004 at 10:41pm | IP Logged Quote shadowspell

Hi all, me again,

I have a .asp form where I collect votes for Peer of the month.
I have another .asp form which shows a running talley of the votes by reading the names of the peers from a table in an Access db.

Right now the talley form works fine but it writes the name of the peer (or colleague) however many times he/she was voted for.
For example if 'Joe Moon' was voted for 6 times, his name will be listed 6 times.

I would like to be able to list each peer's name only once with the # of votes they received written next to their name.

Thanks for any help,
Chris



__________________
~`^%
In Vino Veritas
Back to Top View shadowspell's Profile Search for other info by shadowspell
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: June/20/2004 at 2:51pm | IP Logged Quote cwilliams

Your not telling enough. Unless you show people exactly what you are doing and how you are storing the votes you probably will not get a solution to this question.

Edited by cwilliams on June/20/2004 at 2:51pm


__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
shadowspell
Newbie
Newbie
Avatar

Joined: May/04/2004
Location: United States
Online Status: Offline
Info: 13
Added: June/21/2004 at 10:28am | IP Logged Quote shadowspell

REALLY! Well, my bad then!! Here it is.............

<table border=0 cellpadding=5 cellspacing=0 width="100%" height="0">
                     <tr>
                        <td colspan=2 valign="top">
                          <form name="peer_recog_nomination" method="post">
                            <table width="100%" border="0" cellspacing="0" cellpadding="5">
                              <tr align="left">
                                <td height="30" valign="top"><strong>Elected Peers:</strong></td>
                                <td valign="top"><strong># Votes</strong> </td>
                              </tr>
       <%
       DIM Conn,strConn,SQLstmt,RS
       Set Conn = Server.CreateObject("ADODB.Connection")
       Set RS = Server.CreateObject("ADODB.RecordSet")
       strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("gptw.mdb")
       Conn.Open strConn
       SQLstmt = "SELECT nominee from tbl_peervotes order by nominee;"
       RS.Open SQLstmt, Conn, 2, 3
       DIM nom_count, nom_name
       nom_name = ""
       nom_count = 0
       If Not RS.EOF then
         Do While NOT RS.EOF
         ' Records are ordered by name of electees. nom_count stores number of nominations per person.
         ' When a new nominee is encounterd, nom_count is reset to 1.
         if nom_name <> RS("nominee") then
         nom_count = 1
          else
         nom_count = nom_count + 1
         end if       
         %>
         <tr align="left" valign="top">
                                <td width="42%" valign="top">
         <%=RS("nominee")%>         
         </td>
         <% nom_name = RS("nominee")%>
                                <td width="58%" valign="top"><%=response.write(nom_count)%></td& gt;
         </tr>
         <% RS.MoveNext
         Loop
       Else Response.write "<tr align='left' valign='top'><td width='53%' valign='top'><span class='redbolditalic'>No Votes In Yet</span></td></tr>"
       End If
       %>  & nbsp;  
                            </table>

----------------------------------

Thanks for any help,

Chris



__________________
~`^%
In Vino Veritas
Back to Top View shadowspell's Profile Search for other info by shadowspell
 
Hypa
Newbie
Newbie
Avatar

Joined: June/29/2004
Location: United States
Online Status: Offline
Info: 6
Added: July/01/2004 at 6:21pm | IP Logged Quote Hypa

Take this line outside of the loop.

         <td width="42%" valign="top">
         <%=RS("nominee")%>         
         </td>

you will have to restructure your loop to accomodate it using 2 recordsets.  One which selects the nominees distinctly and another that tallys the votes for each.  Thats one suggestion... you could also add a if then statement checking to see if you are on number 2 and not write the name within your loop... basically walk throuogh the logic step by step you will see it.

 

Hope that helps.



__________________
Never Mess with a geek and his toys!
Back to Top View Hypa's Profile Search for other info by Hypa
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP control controls class classes module script Scripts applet CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com