title: Failed MySQL insert with no error, binding values in execute, PHP
body: <p>I am trying to insert data from an array into MySQL in PHP. I have been working on this for a long time and could use some help debugging. I am not getting any errors which is making it hard for me to find the problem. Any help I could get with this would be appreciated.</p>
  <p>There are more than two items in the $productConfigArray, I only included a sample.</p>
  <p>Here is the code:</p>
  <pre><code> function insertBatch($productConfigArray) 
  {
      try {
  
          $insertStatement = 'INSERT INTO productconfigTEST (productid, partid, currency, fobid, fobpostalcode, pricetype) VALUES';
  
          foreach ($productConfigArray as $index =&gt; $row) {
              $productId = $row['0'];        
              $partId = $row['1'];        
              $currency = $row['2'];
              $fobId = $row['3'];
              $fobPostalCode = $row['4'];
              $priceType = $row['5'];
              
              $insertStatement .= ' (:productId' . $index .', :partId' . $index .', :currency' . $index .', :fobId' . $index .', :fobPostalCode' . $index .', :priceType' . $index .')';
              
              $insertParams['productId' . $index] = $productId;
              $insertParams['partId' . $index] = $partId;
              $insertParams['currency' . $index] = $currency;
              $insertParams['fobId' . $index] = $fobId;
              $insertParams['fobPostalCode' . $index] = $fobPostalCode;
              $insertParams['priceType' . $index] = $priceType;
          }
  
          $productConfigStatement = $pdo-&gt;prepare($insertStatement);
          $productConfigStatement-&gt;execute($insertParams);
  
      } catch(Exeption $e) {
          echo $e-&gt;getMessage();
      }
  }
  </code></pre>
  <p>The $productConfigArray is structured like this:</p>
  <pre><code>       Array
      (
          [0] =&gt; Array
              (
                  [0] =&gt; 0011-02
                  [1] =&gt; 0011-02BK
                  [2] =&gt; USD
                  [3] =&gt; 15068
                  [4] =&gt; 15068
                  [5] =&gt; Net
              )
      
          [1] =&gt; Array
              (
                  [0] =&gt; 0011-05
                  [1] =&gt; 0011-05BK
                  [2] =&gt; USD
                  [3] =&gt; 15068
                  [4] =&gt; 15068
                  [5] =&gt; Net
              )
        )
  </code></pre>
  <p>The completed $insertStatement (after foreach):</p>
  <pre><code>&quot;INSERT INTO productconfigTEST (productid, partid, currency, fobid, fobpostalcode, pricetype, configtype) VALUES (:productId0, :partId0, :currency0, :fobId0, :fobPostalCode0, :priceType0) (:productId1, :partId1, :currency1, :fobId1, :fobPostalCode1, :priceType1)&quot;
  </code></pre>
  <p>The completed $insertParams:</p>
  <pre><code>Array ( [productId0] =&gt; 0011-02 [partId0] =&gt; 0011-02BK [currency0] =&gt; USD [fobId0] =&gt; 15068 [fobPostalCode0] =&gt; 15068 [priceType0] =&gt; Net [productId1] =&gt; 0011-05 [partId1] =&gt; 0011-05BK [currency1] =&gt; USD [fobId1] =&gt; 15068 [fobPostalCode1] =&gt; 15068 [priceType1] =&gt; Net )
  </code></pre>