Date:  03/08/2002 02:36:59 AM Msg ID:  000423
From:  Gia Luc Thread:  000423
Subject:  Session variables, table, or array ?
I am evaluating Foxweb to see if it is appropriate for powering an ecommerce site. 

As with most ecommerce sites, there is a need to keep track of items in a shopping cart.  Having read the Foxweb documentation, I can see only three ways of doing this :

Method 1 :
Hold each field of each item in the shopping cart as session variables.  For example, if a customer orders one product and the shopping cart needs to store the product code and the price, the session variables  will be :

CODE1, PRICE1

If a customer orders two products, the session variables will be :

CODE1, PRICE1
CODE2, PRICE2

If a customer orders three products, the session variables will be :

CODE1, PRICE1
CODE2, PRICE2
CODE3, PRICE3

Method 2 :
Hold each field of each item in the shopping cart in a temporary table ( the temporary table could be named after the session ID, so that each table is unique ).

Method 3 :
Hold each field of each item in the shopping cart in an array, and expand the array as the customer orders more products.

Method 1 seems very clumsy, and I suspect the coding will be very difficult.  Method 2 seems capable of dealing with an infinite number of items in the cart, but requires a temporary table to be created and maintained.  Method 3 seems to give the benefits of Method 2, without any of the downsides.

Questions :
a) Am I missing any other methods ?

b) Are my conclusions correct regarding the advantages/disadvantages of each method ?

c) If I were to implement Method 3, how do I go about maintaining a session array ?  The Foxweb documentation gives details about single element session variables ( each variable holds one value ), but says nothing about session arrays ( if there is such a thing ).

d) If Method 3 is out of the question, I would have to use Method 2.  Has anyone tried this ?  Are there any issues that I need to be aware of ?

Many thanks for your replies.

Gia Luc
IT Manager
( Someone who has tried VB, Delphi, ASP, SQL Server, but has always returned to Foxpro )