Re: Oject passed via session error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux