Ok, so you have this:

items[1][1] = itemID1
items[1][2] = qty1

items[2][1] = itemID2
items[2][2] = qty2

items[3][1] = itemID3
items[3][2] = qty3

In this case my previous assumption would be wrong and the error you 
get
using my code is understandable.  

FYI: you'd be MUCH better off storing them in a single array and 
seperating
them with something (an underscore maybe) like so:

items[1] = itemID1_qty1
items[2] = itemID2_qty2
items[3] = itemID3_qty3

In CF lists are much faster than arrays.  You can access itemID and qty 
by
using listFirst() and listLast().  Besides, it's easier to understand 
and
manipulate single dimension arrays.

Anyway, that being said, here is your problem:
arrayDeleteAt returns a boolean true/false, so when you say
<cfset session.cart = ArrayDeleteAt(session.cart,form.counter)>
you are actually setting session.cart to "true".  Do this:
<cfset temp = ArrayDeleteAt(session.cart,form.counter)>



+-----------------------------------------------+
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 12: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
>
> 

______________________________________________________________________
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=coldfusiona
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