Page 1 of 1

Strange session error

Posted: Sun Jan 28, 2007 12:52 am
by superdezign
Well I'm still making this e-commerce website and I thought my system was finished until I did further testing. Guess what? I can't delete items consistently.

And I've got the weirdest thing. Look at this:

Code: Select all

$current = 0;
foreach($_SESSION['cart'] as $cartItem)
{
	echo $cartItem['qty']." ".$_SESSION['cart'][$current]['qty'];
	$current++;
}
Its printing "2 0." What's up with that??

I'm getting different values. I set it up so that deleting an item simply sets its quantity to zero, and ignores those items. Inefficient, I know, but unset() wasn't working properly. Now this isn't either.

Both methods worked sometimes, but not always. There's got to be a reason for this.

Posted: Sun Jan 28, 2007 4:21 am
by Mordred

Code: Select all

foreach($_SESSION['cart'] as $current=>$cartItem)

Posted: Sun Jan 28, 2007 4:23 am
by superdezign
... *Gasp* Silly me.