Jump to content

An updateable shopping cart, using PHP sessions to store the cart.


snow

Recommended Posts

Hi guys,

 

I'm new at PHP, and currently for university I am undertaking a project with the objective to create "An updateable shopping cart, using PHP sessions to store the cart." Obviously this is too much for anyone to just 'help' me do, so I was wondering whether anyone here could suggest a helpful guide that would help me to understand how to create this.

 

Any help would be much appreciated, thanks in advance.

 

Edit: and yes sorry I forgot to mention I have been looking around on google but haven't found anything really helpful!

Link to comment
Share on other sites

You could have a code that generates a random string of letters/numbers that would be a session id for taht user.  You of course would then set the session as maybe $_SESSION[cart_id] = $string.  Then at the top of your update cart page, just get the users session.  You would then have a table that would be called "cart items" that would look like this:

 

itemID

cartID

 

then when the user clicks on add item or something, make the link something like additem.php?item=$itemid (you would use $_GET['item'] to get $itemid).  Then you just insert the item and the session id's into the database.

 

Hope that helps.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.