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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Array

Status
Not open for further replies.

Dhagaxtuur

Technical User
Apr 15, 2003
47
CA
Help Please:

I have a session array contain list of items (5,20).
I want write out the items but I am getting the index numbers. How do I extract the values from the array?. This partcial code I try:
dim localCart
localCart=Session("cart")
FOR x = LBOUND(localCart) TO UBOUND(localCart)
IF localCart( cProductID, x ) <> &quot;&quot; THEN
RESPONSE.WRITE(localCart(cProductID,x)&&quot; &quot;&localCart(cProductPrice,x)&&quot; &quot;&localCart(cQty,x)&&quot; &quot;&userID&&quot;<BR>&quot;)
END IF
Next

What I am trying to accomplish is session shopping cart. If any one know where can see example of this, please let me know
 
use the multidimentional array properties of ubound, you're only doing the defined array not the dimentional pointers, as in Ubound(localCart,1)

for your x or y values you'll need to use 1 & 2 respectively. without them you're getting a general return for the array size
 
I try this but gives me same thing.
dim localCart
localCart=Session(&quot;cart&quot;)
FOR x = LBOUND(localCart,2) TO UBOUND(localCart,2)
IF localCart( cProductID, x ) <> &quot;&quot; THEN
RESPONSE.WRITE(localCart(cProductID,x)&&quot; &quot;&localCart(cProductPrice,x)&&quot; &quot;&localCart(cQty,x)&&quot; &quot;&userID&&quot;<BR>&quot;)
END IF
Next

Could you give an example. Thnks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top