/    Sign up×
Community /Pin to ProfileBookmark

Which one is preferred?

Which one of these is best for shopping cart?
1. Using session for shopping cart.
2. Storing items in the DB and delete them on completion of purchase.
3. Using array to hold the values. Although, I have not done this before in PHP but it works with COLDFUSION.

I will like a discussion on this. Thanks.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@PineSolPirateFeb 08.2007 — Session and DB are essentially the same there. Session just stores stuff automatically on the server, and DB is a manual thing. I'd go with sessions myself, though if you want them to be able to come back after a session cookie would have expired you could go DB and set a longer cookie, or I believe you can lengthen the session cookie too.

If they have to log in to shop, may as well use the DB.
×

Success!

Help @itbeings spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...