I am doing a PHP based shopping cart for myproject. I am new to those technologies and i do have a questions about how to add product items to the cart before the user login.Because nowadays many online shopping cart uses that facility.Used sessions or cookies to manage the cart.Suppose i used a session named as 'cart'. $_SESSION['Cart'];
after i add those items in to these session array and then store in the database using session name.After User logging i replace session name with user name in the database. Suppose multiple users login for my site and add items to cart before login.Then i only create session array name 'cart' and is there would be a conflict when multiple users adding items to the cart and then retrieving cart items for saving in the database cause i am using the same session based array?
Is there a better way to design that?