title: PHP/MYSQL: batch update multiple values
body: <p>I have figured out how to do a batch update when the value is the same for each record using:</p>
  
  <pre><code>UPDATE tbl SET col1='foo1' WHERE id IN (1,2,3)
  </code></pre>
  
  <p>If I have a comma delimited string of values, that match up to the ids, can I do a batch update that updates the values differently as in</p>
  
  <pre><code>UPDATE tbl SET col1='1,0,1' WHERE id IN (1,2,3)
  </code></pre>
  
  <p>Thanks for suggestions:</p>
  
  <p>Edit:</p>
  
  <p>The html page that sends the data to this query consists of checkboxes as follows:</p>
  
  <pre><code>&lt;input type="checkbox" name="id[]" value="1"&gt;&lt;input type="hidden" name="col1[]" value=0&gt; 
  &lt;input type="checkbox" name="id[]" value="2"&gt;&lt;input type="hidden" name="col1[]" value=1&gt;
  &lt;input type="checkbox" name="id[]" value="3"&gt;&lt;input type="hidden" name="col1[]" value=0&gt;
  </code></pre>
  
  <p>etc. up to 20 boxes.</p>
  
  <p>On the server side, the posted arrays are converted to comma delimited strings using implode so I end up with the two strings, 1,0,1 for the values and 1,2,3 for the ids.  But the user could check up to 20 boxes from this page.  Maybe I have to manipulate the arrays somehow.  Note in the real example, the ids are not 1,2,3, but could be something like 221, 433, 512, 600 etc., depending on what user checks</p>