0

I am having errors inserting records into the "shipping_order" table. Nothing is inserted and no error is returned.

$randomNumber = $order_id = null;
$randomNumber = mt_rand(100, 1000);
$order_id = $user_id.$randomNumber;

$insert = "INSERT INTO shipping_details (order_id,
              user_id) VALUES (
              :order_id, :user_id
              )";
    $shipping_details = $db->query($insert, $param);

    if ($shipping_details){

      foreach ($_SESSION['cart_items'] as $item => $quantity){

        $get_name = "select name FROM items WHERE id = :item_id"; 
        $db->query($get_name, array ('item_id' => $item));
        $item_names = $db->fetch();
        $shipping_order = "INSERT INTO shipping_order (item, quantity, order_id) VALUES (
                          :item, :quantity, :order_id
                          )";

        $db->query($shipping_order, array('item' => $item_names['name'], 'quantity' => $quantity, 'order_id' => $order_id));  

     }
}
shekwo
  • 1,411
  • 1
  • 20
  • 50

0 Answers0