Php-List wrote:
> What is the proper way to transfer class properties through-out my pages...
> 
> let's say i have a ShoppingCart Class and i have methods like
> addToCart(id, qty) and deleteFromCart(id)
> also i have properties like CartItems("id" => array(), "qty"=> array())
> 
> this is what i do...
> 
> //when the user enters my site, i do some...
> -------------
> if (!session_is_registered("myCart")){
>     $myCart = new ShoppingCart();
>     .... (some other stuffs...)
>     session_register("myCart");
> }
> else {
>     $myCart = new ShoppingCart();
> }
> 

You are not following session manual page...

You are over writing $myCart with second "new" statement.
You don't need it and your can use $myCart if
ShoppingCart class definition is included before
starting session.

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages.
Do not reply only to me :)


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

Reply via email to