Updating session user_id without updating session id
I'm having a trouble with my session. I'm building an e-commerce website, people can create cart without login and it will create a session. After that if they want to login I want to update that session with user_id. I can update it but it updating the session id, and my cart has session_id column which doesnt update what should I do?
Your hierarchy seems flipped. Carts shouldn't worry about session ids. Instead, sessions should know cart states. That way you can carry the state through login and you'll have no issue when the session id is regenerated.