title: PHP - MySQL - Bind Multidimensional String Array to Prepared Statemens
body: <p>I am dynamically generating a query as below using a foreach loop:</p>
  
  <pre><code>insert into table (col1, col2, col3, col4) values (?,?,?,?),(?,?,?,?),(?,?,?,?)
  </code></pre>
  
  <p>In the same loop I am creating and array of arrays containing 3 arrays with the values to be inserted. Now how can I bind this multi-dimensional array to my prepared statement? I saw samples running the "execute" of the statement inside the foreach loop for each set of values but I was wondering:</p>
  
  <p>1- If that is the only way to achieve this and there is no way to bind a multi-dimensional array to a prepared statement</p>
  
  <p>2- If executing a statement inside the foreach loop as in the samples I have seen will cause any problems writing to the database (<a href="https://stackoverflow.com/questions/17535999/php-prepared-insert-statement-from-multidimensional-array">PHP prepared insert statement from multidimensional array</a>)</p>
  
  <p>Note: I am using MySQLi with object-oriented style.</p>