How do i put an session array into mysql rows?
Session array output when using print_r($_SESSION['producten']):
Array
(
[producten] => Array
(
[0] => Array
(
[product_id] => 3
[aantal] => 2
)
[1] => Array
(
[product_id] => 2
[aantal] => 1
)
)
)
Mysql:
$order_ins = "INSERT INTO orders_products (order_id,product_id,product_amount) VALUES
('".$_SESSION['order_id']."', '".$_SESSION['product_id']."','".$_SESSION['aantal']."' )";
mysql_query($order_ins) or die("Ehh..error!?" . mysql_error());
What I want is that the "product_id" and "aantal" (means amount in dutch) will be inserted in mysql rows. Afterwards the products and amounts can be filtered using the "order_id"
foreach ($_SESSION['producten'] as $product) {. Insideforeachuse$product['order_id'],$product['product_id']and$product['aantal']in you query.