Jump to content

cookies


stockdalep

Recommended Posts

Hi

 

I have a database and shopping cart, the items are selected by using the session_id in a cookie. So if you log out your cart stays intact.

 

select * from  cart

        inner join household on cart.itemName = household.itemName

        where cart.cookieId = '" .  GetCartId() . "'");

 

GetCartId() runs at first to check if the cookie exists or not, if not create a new one.

 

But when the cookie has expired it writes another one which I have checked and it is a different session_id inside so in theory the last order in the database can now not be selected because the session_id that the SELECT statement uses has changed.

 

But it still appears in the cart. I have echoed out the GetCartId() and it is different from the database cookieId field so I have no idea how this is happening.

 

 

The only way of getting rid of the last order is to delete it from the database.

 

Thanks for any help.

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.