xiao Posted April 23, 2008 Share Posted April 23, 2008 I create my array like this: $_SESSION['ECpc'] = $productcodeEC; $_SESSION['ECid'] = $rij['products_id']; $_SESSION['ECprijs'] = $rij['products_price']; $_SESSION['ECnaam'] = $rij['products_name']; And add stuff to it like this: array_push($_SESSION['ECpc'], $productcodeEC); array_push($_SESSION['ECid'], $rij['products_id']); array_push($_SESSION['ECprijs'], $rij['products_price']); array_push($_SESSION['ECnaam'], $rij['products_name']); And I delete from it like this: array_splice($_SESSION['ECpc'],$id,1); array_splice($_SESSION['ECid'],$id,1); array_splice($_SESSION['ECprijs'],$id,1); array_splice($_SESSION['ECnaam'],$id,1); It all works fine, unless I delete $id = 0, then php always deletes $id = 0 and $id = 2... ??? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 23, 2008 Share Posted April 23, 2008 Unless those are all multidimensional arrays, I don't know why you're using array_push and array_splice instead of just assigning new keys for each value. Quote Link to comment Share on other sites More sharing options...
xiao Posted April 23, 2008 Author Share Posted April 23, 2008 they're 2-dimensional Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 23, 2008 Share Posted April 23, 2008 Oh, okay, I just needed to make sure. So the problem is that PHP deletes 2 and 0 when $id = 0? Quote Link to comment Share on other sites More sharing options...
xiao Posted April 23, 2008 Author Share Posted April 23, 2008 oh, sorry, typo. It deletes id = 1 and id = 0, not id = 2. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.