Welcome Guest, Not a member yet? Register   Sign In
Session problem
#7

[eluser]BrianDHall[/eluser]
[quote author="shinokada" date="1257454084"]After session_start(), I have seen other codes having $cart = $_SESSION['cart'];.
(http://v3.thewatchmakerproject.com/journ...pping-cart)

I still don't understand why it gives errors.[/quote]

The errors are caused by the fact that $_SESSION['cart'] is not a valid array element when you are trying to access it. It is the same thing as doing this, which will also throw an error:

Code:
$a = $b;

...because $b has not been defined.

You'll need to use something like:
Code:
if (! empty($_SESSION['cart']))
{
   $cart = $_SESSION['cart'];
}

...as uberfuzz suggested.


Messages In This Thread
Session problem - by El Forum - 11-05-2009, 12:44 AM
Session problem - by El Forum - 11-05-2009, 03:56 AM
Session problem - by El Forum - 11-05-2009, 06:30 AM
Session problem - by El Forum - 11-05-2009, 06:33 AM
Session problem - by El Forum - 11-05-2009, 07:51 AM
Session problem - by El Forum - 11-05-2009, 08:48 AM
Session problem - by El Forum - 11-05-2009, 09:23 AM
Session problem - by El Forum - 11-05-2009, 10:47 AM
Session problem - by El Forum - 11-05-2009, 10:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB