What is the best way?
Do I have to store the object in the session and transfer it from page to page, or should I query the database every time a user goes to another page in my web application?
If I have to store my object in a session, how would I do it? I tried doing this with serialization and unserialize, but it does not work for me ...
Thanks for any help!
EDIT: Here are some of my code
Page 1:
include "user.php";
session_start();
$user = new user();
$user->$username = "Jason";
$_SESSION["user"] = $user;
header("Location: profile.php");
Page 2:
include "user.php";
session_start();
$user = new user();
$user = $_SESSION["user"];
echo $user->$username;
No results.
source
share