Re: Oject passed via session error
| From: | Chris | Date: | Sat, 25 Mar 2006 18:25:58 +0000 |
| Subject: | Re: Oject passed via session error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232574@lists.php.net to get a copy of this message | ||
You need to declare the class before you call session_start(). Otherwise it can't create the object properly.
Peter Lauri wrote:
Hi, I do this: <?php session_start(); require_once('classes/ns_cart.class.php'); if(!isset($_SESSION['ns_cart'])) $_SESSION['ns_cart'] = new NScart(); ?> The output will be the following with print_r of the $_SESSION: -------------------- Array ([ns_cart] => nscart Object ( [myProducts] => Array ( [0] => ns_product Object (--------------------- When I reloads the page I get the following: -------------------- Array ([ns_cart] => __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => nscart [myProducts] => Array ( [0] => __PHP_Incomplete_Class Object--------------------- What is this? I am confused... /Peter