title: MySQL Transaction Syntax Error
body: <p>The following is throwing a syntax error. The entire query works in a MySQL client with literals, but breaks down when passing from PHP. In PHP, each query works if submitted separately, but not if within <code>START</code> and <code>COMMIT</code>. </p>
  
  <p>The error: </p>
  
  <pre><code>1064: You have an error in your SQL syntax; check the manual ...etc...right
  syntax to use near 'INSERT INTO user_degrees (user_id, degree_id, acadcat_id
  , inst_id) VALUES (' at line 2
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>$query="START TRANSACTION;
  
  INSERT INTO user_degrees (user_id, degree_id, acadcat_id, inst_id) 
  VALUES ((SELECT id FROM users WHERE users.username = '$user')
     , '$degreeid', '$studyfocus', '$institution');
  
  UPDATE users 
  SET degree".$dnum." = (SELECT LAST_INSERT_ID())
  WHERE username = '$user';
  
  COMMIT;";
  </code></pre>
  
  <p>All the $vars are class properties and pass integers, except for $user, which passes a username session variable. $dnum is used to change column names between instances of the class and I might be concatenating it incorrectly within MySQL.</p>