this source code form a shopping-cart, I'm confuseing on the array of
"arrCart", is it a table? a multidimensional array seems like a table
from the view of data structure?
add a new record to a array is so simple:?
arrCart(cProductid,scartItem) = lngcatalogID
in ASP, the declaration of declare a multidimensioanl array is same to
a variety? don't need to care about the amount of element?
Dim arrCart
arrCart(cProductid,scartItem) = lngcatalogID
could consider that "cProductid" and "scartItem" as a field?
maybe my word have confused you, wish you could know my question :-)
<%
'******CartAddItem
dim mycolor
Sub CartAddItem(id, rc)
' Return 0 if added, 4 if product does not exist
' Get from datbase and add to instorage array
dim scartitem
Dim arrCart
Dim TotalOptionPrice
Dim Optionname
CartGetProduct Id, rc
if rc = 0 then
arrCart = Session("MyCart")
scartItem = Session("cartItem")
scartitem=scartitem+1
Session("cartItem")=scartitem
arrCart(cProductid,scartItem) = lngcatalogID
arrCart(cProductCode,scartItem) = strccode
arrCart(cProductname,scartItem) = strcname
If isnumeric(quantity) then
arrCart(cQuantity,scartItem) = CInt(quantity)
else
arrCart(cQuantity,scartItem) = 1
end if
arrCart(cUnitPrice,scartItem) = curCprice +
TotaloptionPrice
Session("MyCart")=arrCart
end if
end sub
%>
I'm sorry my english is so poor,
so forgive me if my word had make you uncomfortable.
I'll try my best to express my question correctly