I have a doubt.
I'm planning a shopping cart. This is what I've planed so far:
The 'cart' will be stored in a session array.
Options will be
PRODUCT NAME [add] [remove] [change quantity]
My doubt is, how should I do this array? The structure? I will need to save a product id, and the value of Quantity.
perhaps
array[index][prodid] = x
array[index][number] = x
Meaning
array[0][prodid] = 1 // product_id in db
array[0][number] = 1 // how many unities
array[1][prodid] = 2
array[1][number] = 1
array[2][prodid] = 5
array[2][number] = 2
Is this a good idea? Anyone has a better one?
Whould I do it with a db table instead of using a session array?
What would be faster?
Thanks in advance.