title: I want to update multiple rows which are selected through checkbox
body: <p>Am selecting rows via checkbox through this loop applied on select query.   </p>
  
  <pre><code> while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo '&lt;tr&gt;';
      $res = $row['userid'];
      echo "&lt;td&gt;&lt;input type='checkbox' name='chk[]' value='$res'&gt;&lt;/td&gt;";
  
     echo 
      "&lt;td&gt;ID :{$row['userid']}  &lt;br&gt; &lt;/td&gt;".
      "&lt;td&gt;ID :{$row['id']}  &lt;br&gt; &lt;/td&gt;".
      "&lt;td&gt;{$row['name']}  &lt;br&gt; &lt;/td&gt;".
      "&lt;td&gt;{$row['shifttime']}  &lt;br&gt; &lt;/td&gt;&lt;/tr&gt;";
        $i++;    
     } 
  </code></pre>
  
  <p>Then want to update my db through the id's am getting from checkboxes</p>
  
  <pre><code> if(isset($_POST['chk'])){
      $shift=$_POST['shiftTime'];
      $chkarray = $_POST['chk'];
      foreach ($chkarray as $val) {
      $sql = "UPDATE user_shift_test2 SET shifttime ='$shift' WHERE id='" . $_POST["chk"] . "' ";
      $result = mysql_query( $sql, $conn);
  </code></pre>
  
  <p>Thanks.</p>