title: On Duplicate Key Update - Multiple Columns
body: <p>When using <a href="http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html" rel="noreferrer">insert... on duplicate key update</a>, what is the syntax to update multiple columns?</p>
  
  <pre><code>INSERT INTO table1 (col1, col2, col3, col4) VALUES (’$val1’, ‘$val2’, ‘$val3’, ‘$val4’)
  ON DUPLICATE KEY UPDATE col2=‘$val2’, col3=‘$val3’, col4=‘$val4’ // &lt;-- not sure
  </code></pre>
  
  <p>Update: I am using this within PHP. Since this is a syntax question, it very relevant.</p>
  
  <pre><code>$result = mysql_query("INSERT INTO table1 (col1, col2, col3, col4) 
                           VALUES (’$val1’, ‘$val2’, ‘$val3’, ‘$val4’)
                           ON DUPLICATE KEY UPDATE (col2=‘$val2’, col3=‘$val3’, col4=‘$val4’)")
  </code></pre>
  
  <p>Again, not sure about this last part with the "Update".</p>