title: Inserting array returning incomplete data (MySQL/PHP)
body: <p>I have an insert command based on the following: </p>
  
  <pre><code>$baseINS = "INSERT INTO table2 (Points_ID, StaticCode) VALUES ";
  $arrayINS = explode(", ", $arraystring);
  foreach ($arrayINS as &amp;$array1INS) {
      $array1INS = "('" . $array1INS . "', '123456')";
  }
  $arrayvaluesINS = implode(', ', $arrayINS);
  $insertSQL2 = $baseINS . $arrayvaluesINS;
  </code></pre>
  
  <p>The <code>$insertSQL2</code> is queried from the following transaction:</p>
  
  <pre><code>$insertSQL = "BEGIN";
  mysql_query($insertSQL) or die (mysql_error());
  $insertSQL = $insertSQL1;
  mysql_query($insertSQL) or die (mysql_error());
  $insertSQL = $insertSQL2;
  mysql_query($insertSQL) or die (mysql_error());
  $insertSQL = "COMMIT";
  mysql_query($insertSQL) or die (mysql_error());
  </code></pre>
  
  <p>(where <code>$insertSQL1</code> is another SQL insert, to another table)</p>
  
  <p>Table structure as follows:</p>
  
  <blockquote>
    <p><code>table2
    </code> (   <code>ID</code> int(50) NOT NULL AUTO_INCREMENT,<br>
    <code>StaticCode</code> varchar(100) NOT NULL,
    <code>Points_ID</code> varchar(50) NOT NULL,
    PRIMARY KEY (<code>ID</code>),
    UNIQUE KEY <code>ID</code> (<code>ID</code>)
    ) ENGINE=InnoDB</p>
  </blockquote>
  
  <p>Now, let's say for example that <code>$insertSQL2</code> echos as <code>INSERT INTO table2 (Points_ID, StaticCode) VALUES ('24859', '123456'), ('24649', '123456'), ('25166', '123456')</code></p>
  
  <p>I would expect three rows to appear in the table2 ...but this is what happens:</p>
  
  <ul>
  <li>Both the insert commands (<code>$insertSQL1</code> and <code>$insertSQL2</code>) do, in fact, insert data.</li>
  <li>It's just that, while <code>$insertSQL1</code> inserts all of the data from all of the form to the required fields in table1, the <code>$insertSQL2</code> (which is inserting the array) doesn't - it just inserts the static code, once, and leaves the Points_ID blank.</li>
  </ul>
  
  <p>I have tested the INSERT statement by just copying the echoed command into PHPMySQL, and it does exactly what it is supposed to, so I know that my version of MySQL can handle it.</p>
  
  <p>Any ideas why?</p>