Just wondering about this (there is probably a not too difficult answer to this, but I can't seem to find the answer online )

How do you keep an object across multiple pages? Say you have a class called Users that pretty much models everything about a user (user name, user id, age, location, user type etc etc.) and you query the database based on the user's login to form the object then store the user_id as a session information. The user clicks on the send a message link, and you'll have to read the user_id for the session and query the database again.

Is there a better way of doing this, or is my concept totally wrong to begin with?

Thanks