title: PHP loop to make MYSQL Queries
body: <p>I have a list of IDs generated from a set of checkboxes as follows:</p>
  
  <pre><code>$list = mysql_real_escape_string(implode(',',$_POST['checkbox']));
  </code></pre>
  
  <p>which outputs a list like this:</p>
  
  <p>a,b,c</p>
  
  <p>I want to set a column in a MYSQL database that corresponds to each list item, I am unsuccessfully trying to create a query with a foreach loop like so:</p>
  
  <pre><code>$update_query= '';
  foreach($list as $item){     //error on this line
   $update_query .= "
    INSERT INTO t (Col_1, Col_2)
    VALUES  ('".$item."',now());
       ";}
  </code></pre>
  
  <p>It fails telling me I have supplied an invalid argument for foreach(), but I'm not sure, a. what that means, and b. how to fix it; can anyone offer any guidance to get my loop working or a better way of doing this INSERT.</p>
  
  <p>Thanks </p>