Pros and Cons for Shopping Cart System??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Pros and Cons for Shopping Cart System??

Post by JPlush76 »

I'm working on a OOP shopping cart system from scratch for my company.

Based on the following criteria.. speed, security, functionality, overall

Do you think its better to store the product information as an array in the session variable or is it better to store the shopping cart in the database where each product has its own row with a crypted session ID as the user's key?

Any know the pros and cons of each?

I could think off the top of my head that the array system might be faster and be able to handle more users because you're not doing database queries everytime you mess with the cart, but then what about security and functionality?
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

I think database -> Less security risk. Quite easy to use. Or you could make your own session_save_handlers then you store the info to MySQL db or PosgreSQL.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

I too would suggest the database, as long as your estimated server load can handle it. Of course if you're already using the database for other operations on the site there is very little overhead so it just makes sense...

BTW, I've been gone for a while, trying to finish my darn thesis, but I found a nice article on security/cookies if you're interested at:
http://pdos.lcs.mit.edu/cookies/pubs/webauth:tr.pdf
Post Reply