Stut a écrit :
On 2 Mar 2008, at 16:32, Richard wrote:
Stut a écrit :
Just curious... why are you setting the password to an empty array?
You'd probably be better off unset'ing it so you can use isset to
check for it.
Oh right ! :)
Yes you're right about the array, I used it by mistake, as to reset
a value in $_SESSION[cart] , ie : $_SESSION['cart']['item_number'] I
had to do $_SESSION['cart']['item_number'] = array(); as unset would
anly work for unsetting the whole cart and not just one item, but yes
it would be best to use unset for $_SESSION['password'] !
Eh? What's in $_SESSION['cart']['item_number']? You might want to
consider one of the following depending on what's in that array
element...
unset($_SESSION['cart']['item_number']);
unset($_SESSION['cart'][array_search($itemtoremove, $_SESSION['cart'])]);
unset($_SESSION['cart']['item_number'][array_search($itemtoremove,
$_SESSION['cart']['item_number'])]);
At the very least it would be better to use null rather than array(),
but actually removing the item from the array would be my recommendation.
-Stut
Sorry I went back to where I read that I should use =array(); and I miss
read an instruction which was : http://fr3.php.net/unset
|
|Quote from http://fr.php.net/session_unset
"Do NOT unset the whole $_SESSION with unset($_SESSION) as this will
disable the registering of session variables through the $_SESSION
superglobal."
So basically don't do:
unset($_SESSION)
Instead do:
$_SESSION = array();|
So no need for setting my session variables to array()...
|
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php