Hi
I have managed to add items to a shopping cart session array using this method:
$_SESSION['basket'][$_POST['id']] = array('quantity' => $_POST['quantity'], 'productprice' => $_POST['productprice']);
This works great, however, I am now at the stage where I need to extract the results from the session array and display the data on screen - like you would see in your Basket View on a website.
I planned to run a query which selects the product data from the database where the product 'ID' is found within the Session Array, but i have no idea how to reference or explode this session array so I can access the data.
Can anyone explain or point me in the right dircetion of how i go about referencing the data within these session arrays (example below):
Array
(
[5] => Array
(
[quantity] => 1
[productprice] => 100.00
)
[7] => Array
(
[quantity] => 1
[productprice] => 300.00
)
[6] => Array
(
[quantity] => 1
[productprice] => 200.00
)
[8] => Array
(
[quantity] => 1
[productprice] => 400.00
)
)
Thanks for any help you can offer as I am very new to using associative arrays.