RE: [PHP] PHP- accessing session var
| From: | Ford, Mike [LSS] | Date: | Thu, 14 Aug 2003 10:57:56 +0000 |
| Subject: | RE: [PHP] PHP- accessing session var | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159545@lists.php.net to get a copy of this message | ||
On 13 August 2003 23:00, Mignon Hunter wrote:
> Hi
>
> This will be real simple for you guys. When I print_r my session
> vars part of what get is:
>
> [_SESSION] => Array
> (
> [cart] => shoppingcart Object
> (
> [contents] => Array
> (
> [37] => Array
> (
> [qty] => 1
> )
>
> )
>
> [total] => 70
> [weight] => 0
> [cartID] =>
> [content_type] => physical
> )
> SO I'm trying to capture the total(70). I'm trying
> $_SESSION['cart']['total']
>
> But I'm not getting it. This is a multidimensional array isnt it ? --
No, it's a 1-dimensional array containing an Object of class shoppingcart,
so you want:
$_SESSION['cart']->total
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211