*SOLVED*Sending Classes as $_SESSION variables
Posted: Tue Mar 09, 2004 12:18 pm
im working on something right now, and it requires me to send a class in between multiple pages. i would like to do this through Sessions. what i do in my index.php is:
this works, as if i go to my next page that uses the User class, if i type in
if will return Object, so it IS being passed. but when i do something like
it returns the following error:
Code: Select all
<?php
$User = new User; //Declare new class
$User ->Import($INFO, $ID) //Imports variables from database to $User
$_SESSION['User'] = $User
?>Code: Select all
<?php
echo $_SESSION['User'];
?>Code: Select all
<?php
echo $_SESSION['User'] ->ID; //Echo part of class
?>what am i doing wrong??Fatal error: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition user of the object you are trying to operate on was loaded _before_ the session was started in /var/www/html/SciFi/shop.php on line 69