PHP - Adding Array to INSERT

-2

I created code to add to the array, but gave me an error:

  

error: Notice: Array to string conversion in D: \ xampp \ htdocs \ Superfacil_v1.3.8 \ inc \ buildpay \ payitem.php on line 86

How do I add all session items to multiple INSERTS.

foreach($_SESSION['shopping_Cart'] as $keys => $values) {

  $item_updated = array(
     'item_id' => $values['item_id'],
     'item_name' => $values['item_name'],
     'item_price' => $values['item_price'],
     'item_qty' => $values['item_qty']
  ); 

  $stmp_request_payment = "INSERT INTO public_order_checklist (client_id, date, product_id, product_name, product_price, product_qty) 
      VALUES('".$_SESSION['u_id']."', NOW(), $item_updated)";
  $stmp_query_payment = $con->query($stmp_request_payment);                                              
}
    
asked by anonymous 13.10.2018 / 22:20

1 answer

-1

I do not understand why this array is all right:

$stmp_request_payment = "INSERT INTO public_order_checklist (client_id, date, product_id, product_name, product_price, product_qty)"
    . "VALUES(?,?,?,?,?,?)";
$params = array($_SESSION['u_id'], NOW(),
$values['item_id'],$values['item_name'],$values['item_price'],$values['item_qty']);
$stmp_query_payment = $con->query($stmp_request_payment, $params);

It probably works like this.

    
16.10.2018 / 16:45