Why not prevent the user from adding the item twice?

Will

----- Original Message -----
From: "Michel Gagnon" <[EMAIL PROTECTED]>
Newsgroups: cf-talk
Sent: Thursday, June 21, 2001 8:23 PM
Subject: Basket problem


> Hi!
>
> I have a small problem.
> I have a delete button set up that deletes
> items in the basket.  Only that if the person
> accidentally added the same item twice and want to remove one,
> it deletes both.
>
> <cfset newBasket = queryNew("ID, Quantity")>
>
> <cfloop query="session.basket">
> <!--- Add anything that isn't in the delete list --->
> <cfif Not(ListFind(Form.ID, ID))>
> <cfset tmp = queryAddRow(newBasket)>
> <cfset tmp = querySetCell(newBasket, "ID", ID)>
> <cfset tmp = querySetCell(newBasket, "Quantity", quantity)>
> </cfif>
> </cfloop>
> <!--- set the basket to the new values --->
> <cfset session.basket = newBasket>
>
>
> Is there another way of doing this?
>
> TIA,
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to