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
https://forums.phpfreaks.com/topic/45037-cookies/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.