Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop Problems

Status
Not open for further replies.

acewilli

IS-IT--Management
Apr 11, 2003
98
US
Hello,

I am creating a site using vbscript that allows people to vote using a points system. Each person gets 10 points a month in which they can give points to any other person that they want to vote for. What is the best way to do the loop code for this? Below is some more detail.

dim points '10 points total for each month
dim npoints 'this is the points that are given for voting
dim tpoints 'this is the result of points-npoints

I don't want anyone to be able to use more than 10 points but I need to keep up with how many points they use. Below is a little bit of code that I'm working on which is really bad right now. I appreciate any help in advance and hope that you understand what I need. Thank you! Acewilli

If Request.Form("submit") = "Update" Then
While not rsStatus.eof
ID = rsStatus("ID")
smember= Replace(Trim(Request.Form("txtmember"& ID)),"'","''")
ppoints= Replace(Trim(Request.Form("txtpoints"& ID)),"'","''")
npoints= Replace(Trim(Request.Form("txtnpoints"& ID)),"'","''")
'Need Loop here I think??
tpoints= ppoints - npoints
strSQL = "UPDATE Team SET member='"& smember &"', points='"& tpoints &"', tpoints='"& tpoints &"' WHERE ID="& ID
db.Execute strSQL
rsStatus.movenext
Wend
rsStatus.movefirst
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top