I wouldn't really store all values for the product in array in a column in a table.
I would create a table to store orders made.
order-table:
orders
order_id (primary key)
product_id (reference to which product it is in products-table)
quantity
price (price when purchased the product)
Based on the session you have:
Array (
[5] => Array ( [quantity] => 1 [price] => 45.00 )
[7] => Array ( [quantity] => 1 [price] => 18.00 )
)
If 5 and 7 is your actual productids, then you should store the values something like this in orders-table:
INSERT INTO orders (product_id, quantity, price) VALUES (5, 1, 45000);
INSERT INTO orders (product_id, quantity, price) VALUES (7, 1, 18000)
If you have a product that costs 45.50 you should store it like this:
INSERT INTO orders (product_id, quantity, price) VALUES (5, 1, 45500);
The reason why this is a better approach is that is far more easy to extract information about any order later on. (for example to return all sales for a specific product)
If you then want to get the total for a specific order, just do a SQL:
SELECT SUM(price) FROM orders WHERE order_id = 14 (example for order 14)
If you want to return all values for the order, you just do like:
SELECT * FROM orders WHERE order_id = 14 (example for order 14)