Re: Multiple sessions open at same time, is it possible? [ Solved, thankyou !]
| From: | Stut | Date: | Sun, 02 Mar 2008 16:44:30 +0000 |
| Subject: | Re: Multiple sessions open at same time, is it possible? [ Solved, thankyou !] | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270837@lists.php.net to get a copy of this message | ||
On 2 Mar 2008, at 16:32, Richard wrote:
Stut a écrit :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 -- http://stut.net/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'] !