database - In PHP if I want each user to have data unique to them that I want to be retained, and to be loaded just whenever they login how would I do so?
I've heard that creating a session and assigning a session ID to each user is the way to go for a case like this. However, I'm still a little unsure- if the user closes their browser or clears their cookies then the session is deleted from what I understand. And even then, sessions are temporary so the session will be deleted regardless. Doesn't that mean that whenever the session ends- the users data is wiped? And therefore if they wanted to get their data back they'd have to create a brand new account and the program would have to interpret their new data all over again only to be deleted again later? I apologize for my lack of understanding- I'm fairly new to this. How would I make it so that my website retains the data unique to each user permanently? And am I misunderstanding the concept of sessions in PHP?This image will show the design structure of my two tables. I've attempted to reference one to the other to no avail unfortunately. The green link between them represents the reference of the idUsers column in the "users" table (user account information), and the userIDs as the foreign key, a column in the "user_classes" table.