Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 7th, 2004, 10:46 AM
LabRat404 LabRat404 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 LabRat404 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
infinite loop...but where?

this code is excerpted from an asp script I'm writing for a shopping-cart system on a web site. the database of items is in a file on the server. the problem is that I can add any one item, and as many of that one item as I want. but when I add two different items and or any amount of either at the same time, and submit, this code gets stuck in an infinite loop.

this part of the code is the part that submits the data.

EDIT: sorry for the bad formatting, the forums did that.

EDIT: nevermind! Its working now...but I dont know what it was! how lucky, eh?

Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Instantiate the FileSystemObject
Set TS = objFSO.OpenTextFile(strFileName, 1, False) 'use Opentextfile Method to Open the text File

noredun = 0
totPrice = 0
allNum = 0

do while cart.count <> 0

c = 0
dontCheck = false
quan = 0

Do While cart.count > c

if dontCheck = false then
ProdNum = TS.ReadLine 'get product number
ProdName = TS.ReadLine 'get name of product
ProdPrice = TS.ReadLine 'get product price
end if

if ProdNum = tmpItems(c) then 'found one
totPrice = totPrice + ProdPrice
if quan = 0 then noredun = noredun + 1 'keep track of how many DIFFERENT items we have found (not including redundancies)
allNum = allNum + 1
quan = quan + 1 'keep track of how many items we have found ALL together for this specific item (including redundancies)
dontCheck = true 'we also need to not read in any more from the database until we've checked the rest of the cart list for redundancies of this item
k = Cart.Keys 'reset this variable because we are about to use it
Cart.Remove trim(k(c)) 'remove it from the cart
tmpItems = Cart.Items 'reset this variable because we removed an item
else
if dontCheck = true then c = c + 1 'found one once before. keep moving up the list
end if
Loop

MailMessage = MailMessage & "Qty:" & quan & " " & ProdNum & " " & ProdPrice & " " & ProdName & linebr
TS.close 'reset the file for reading
if cart.count < 1 then exit do
Set TS = objFSO.OpenTextFile(strFileName, 1, False)
loop

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > infinite loop...but where?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway