DSFDF, of course.  i prefer structures, because you can iterate over
your array VERY easily.

<CFLOOP INDEX="fred" FROM="1" TO="#ArrayLen(myarray)#">
.do stuff with myarray[fred].product_id and myarray[fred].quantity...
</CFLOOP>

this is assuming, of course, that each element of myarray is a structure
with keys of product_id and quantity.

i suppose it's just the way my mind works, as to why i prefer this.

christopher olive, cto, vp of web development
atnet solutions, inc.
410.931.4092
http://www.atnetsolutions.com


-----Original Message-----
From: Douglas Jordon [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 4:23 PM
To: CF-Talk
Subject: Re: Deleting Row from Array


Why is that? I thought a two dimension array was the choice since I need
to
store ids and quantities. I could have used a list, but I'd never used
arrays before and it didn't seem inappropriate.

Christopher Olive wrote:

> if that's the case, you'd probably be better using an array of
> stuctures.  your process seems to lend itself to that data design,
IMHO.
>
> christopher olive, cto, vp of web development
> atnet solutions, inc.
> 410.931.4092
> http://www.atnetsolutions.com
>
> -----Original Message-----
> From: Douglas Jordon [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 15, 2002 3:12 PM
> To: CF-Talk
> Subject: Re: Deleting Row from Array
>
> It's two dimensional because I'm storing item ids and quantities, so
> [1][1] is an id and [1][2] is a quantity etc.
>
> With your code I'm getting:
>
> ArrayDeleteAt(Array, Position): Cannot delete element at position 3.
The
> array has only 2 elements.
>
> And the Array has three elements.
>
> Bryan Love wrote:
>
> > Why is it a two dimensional array?
> >
> > A two dimensional array is an array of arrays...
> >
> > Say a person has 3 items in their basket...
> >
> > if you store them like so...
> > basket[1][1]
> > basket[1][2]
> > basket[1][3]
> > ..then deleting item 1 in the first dimension wipes out the entire
> > basket.
> > Try this...
> > <cfset session.cart = ArrayDeleteAt(session.cart[1],form.counter)>
> >
> > If you aren't storing the items in the above fashion then you'll
need
> > to
> > provide more info before you'll find a solution.
> >
> > +-----------------------------------------------+
> > Bryan Love
> >   Macromedia Certified Professional
> >   Internet Application Developer
> >   Database Analyst
> > Telecommunication Systems
> > [EMAIL PROTECTED]
> > +-----------------------------------------------+
> >
> > "...'If there must be trouble, let it be in my day, that my child
may
> > have
> > peace'..."
> >         - Thomas Paine, The American Crisis
> >
> > -----Original Message-----
> > From: Douglas Jordon [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, February 15, 2002 11:14 AM
> > To: CF-Talk
> > Subject: Deleting Row from Array
> >
> > Hi,
> >
> > I'm using ArrayDeleteAt to remove single items from a shopping
cart(my
> > first):
> >
> > <cfset session.cart = ArrayDeleteAt(session.cart,form.counter)>
> >
> > It's removing everything from the array instead of one row. It's a
two
> > dimensional array.
> >
> > TIA,
> >
> > Doug Jordon
> >
> >
>
> 

______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to