Re: Can't printout class variable
| From: | Sumeet | Date: | Tue, 24 Jan 2006 03:46:24 +0000 |
| Subject: | Re: Can't printout class variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229148@lists.php.net to get a copy of this message | ||
Scott Gunn wrote:
This should be simple. What am I doing wrong?
Here is the code that is failing:
$user = $_SESSION['user'];
print_r($user);
echo "Welcome " . $user->firstName;
The print_r command prints out:
__PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => User [isLoggedIn] => 1 [lastName] => Gunn [firstName] => Scott )
try
$user = (User)$_SESSION['user'];
rest remains the same.
--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India