Now, here's my problem - how can I remove a row from the array (let's say it's a shopping basket). I've tried using unset($_SESSION['Pens'][0]) for example - but all it does is clears the entries in that row, and the shopping cart displays a blank line.
Update Quantity
Also, if the user inputs the same entry twice (unique ID), then how does one 'Update' that row with the new quantity ($NewQty = $NewQty + $OldQty). As opposed to two array entries displayed in the shopping cart, when I can just update the quantity in the session.
Question
DjmUK
Hi there,
I can store data into a session, seperating the data by a comma. So here's an example using 'Pens'.
I then extract the information and link the $Pen_ID into MySQL (using the explode(); function) and echo'ing into a table.
Deleting A Row
Now, here's my problem - how can I remove a row from the array (let's say it's a shopping basket). I've tried using unset($_SESSION['Pens'][0]) for example - but all it does is clears the entries in that row, and the shopping cart displays a blank line.
Update Quantity
Also, if the user inputs the same entry twice (unique ID), then how does one 'Update' that row with the new quantity ($NewQty = $NewQty + $OldQty). As opposed to two array entries displayed in the shopping cart, when I can just update the quantity in the session.
Thanks in advance.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts