title: what is hapenning with my foreach at the moment to insert data to db?
body: <p>I want to insert my data in to my database when I try to added as my <code>product_id</code> is an <code>array</code> then show me an error like this , i need to add it one by one, but I want to add them altogether if I Have <code>2 , 3 , 4 , 10+ etc</code> etc , how can I iterate on my <code>foreach</code> in my <code>model</code> to add them?</p>
  
  <pre><code>Operand should contain 1 column(s)
  
  INSERT INTO storelte_notifications (message,type,product_id,user_id,timestamp) VALUES('low stock', 'low stock', ('4170','4171'), 1, 1500579824)
  </code></pre>
  
  <p><strong>My Controller:</strong></p>
  
  <pre><code>&lt;?php
      public function tests() {
          $array = $this-&gt;sale-&gt;get_all_cart($this-&gt;session-&gt;carrito);
          foreach ($array as $key =&gt; $value) {
              $product_id[] = $value['id'];
          }
          $entryData = array(
              'message' =&gt; 'low stock',
              'product_id' =&gt; $product_id,
              'user_id' =&gt; 1,
              'type' =&gt; 'low stock',
              'timestamp' =&gt; time()
          );
          $this-&gt;notification-&gt;addNotification($entryData);
      }
  ?&gt;
  </code></pre>
  
  <p><strong>My Model</strong> </p>
  
  <pre><code>&lt;?php
      function addNotification(Array $data) {
          $types = array(
              'new' =&gt; 0,
              'pending' =&gt; 1,
              'low stock' =&gt; 2
          );
          if (isset($types[$data['type']]) === false) {
              throw new \InvalidArgumentException('Value for third parameter must be one of new, pending, or low stock.');
          }
          $type                 = $types[$data['type']];
          $query                = "SELECT COUNT(*) AS notificationCount FROM storelte_notifications WHERE product_id IN ? AND type = ? ";
          $previousNotification = $this-&gt;db-&gt;query($query, array(
              $data['product_id'],
              $data['type']
          ))-&gt;result_array();
          if ($previousNotification[0]['notificationCount'] &gt;= 0) {
              $sql = "INSERT INTO storelte_notifications (message,type,product_id,user_id,timestamp) VALUES(?, ?, ?, ?, ?)";
              try {
                  /*foreach ($data as $value) {
                  print_r($value['product_id']);
                  }*/
                  if (!$this-&gt;db-&gt;query($sql, array(
                      $data['message'],
                      $data['type'],
                      $data['product_id'],
                      $data['user_id'],
                      $data['timestamp']
                  ))) {
                      return false;
                  }
                  return true;
              }
              catch (Exception $e) {
              }
          } else {
              return true;
          }
      }
  ?&gt;
  </code></pre>