PHP Sessions - best way to store multiple entries?

  • Thread starter Thread starter Ducky
  • Start date Start date
D

Ducky

Guest
I need to make a shopping cart, basically, of items that have the same names. No database will be used to hold the items, so sessions is the way. As of right now, I have sessions for each property of an item, and then those go into an array, and that array is piled into a larger array, and if the person wants to add something else, the sessions holding the data added to the larger array are cleared.

I'm not sure this is the best way, since arrays need to be comma separated, and I'm pretty sure by the second item my plan will fail.

So, basically... is there a better method to this madness?

Thanks. :)
Nevermind.

I wasn't thinking clearly. I just made the all-encompasing session in to a normal '$_SESSION['name'][] = data' type of array itself, and then did a foreach on that. Oops.

Oh well. I'll leave this here for future reference.
 
Back
Top