title: Unable to update the first row returned using php
body: <p>I have created a page that brings up the rows in my table with a archive/delete button alongside which will set the deleted flag to 1 and this works fine. however if I press the button on the first row, it fails to run the archive/delete php code. I can update the other rows but never the very first one. Any ideas or help would be apprecated.</p>
  
  <p>Main page for the delete rows option</p>
  
  <hr>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;?php include 'librarylinks.php'; ?&gt;
  &lt;/head&gt;
  &lt;body &gt;
  &lt;?php include 'main_nav_bar.php'; ?&gt;
  &lt;div id="container"&gt;
  &lt;?php
  require_once('db_login.php');
  $result = $conn-&gt;query("SELECT * FROM masstimes where mt_deleted = 0");
  if (!$result) {
  die($mysqli-&gt;error);
  }
  if ($result-&gt;num_rows &gt; 0) { 
  // output data of each row
  echo ' 
  &lt;form id="form1" name="form1" method="POST""&gt;
  &lt;table class="table table-condensed table-hover" &gt;
  &lt;tr&gt;&lt;/tr&gt;
  ';
  while($row = $result-&gt;fetch_assoc()) {   
  $mt_serial = $row["mt_serial"];
  $mt_description1 = $row["mt_description1"];
  $mt_description2 = $row["mt_description2"];
  echo '
  &lt;tr&gt;
  &lt;td&gt;&lt;p&gt;' . $mt_description1 . '&lt;/p&gt;&lt;/td&gt;
  &lt;td&gt;&lt;p&gt;' . $mt_description2 . '&lt;/p&gt;
  &lt;a class="btn btn-danger btn-xs just_hide file_actions" data-toggle="modal" data-target="#delete_confirm' . $mt_serial . '"&gt; &lt;i class="glyphicon glyphicon-trash  " style="cursor\:pointer"/&gt;&lt;/i&gt; Delete &lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  ';
  echo '
  &lt;div class="modal fade" id="delete_confirm' . $mt_serial . '"&gt;
  &lt;div class="modal-dialog modal-sm"&gt;
  &lt;div class="modal-content"&gt;
  &lt;div class="modal-header"&gt;
  &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
  &lt;/div&gt;
  &lt;div class="modal-body"&gt;
  &lt;p class="text-center" style="font-size: bold"&gt;Are you sure you want to delete this comment?&lt;span id="del_serial"&gt;&lt;/span&gt;
  &lt;/p&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
  &lt;form id="form1" name="form1" method="POST"     action="delete_mass_times.php"&gt;                 
  &lt;button type="button" class="btn btn-success btn-xs" data-dismiss="modal"&gt;&lt;i class="glyphicon glyphicon-remove"&gt;&lt;/i&gt; Cancel&lt;/button&gt;
  &lt;input type="hidden" name="mt_serial" value="'. $mt_serial . '"&gt;
  &lt;input type="submit" name="delete_mts" id="delete_mts" value="Confirm Deletion" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt; ';   
  }
  echo '&lt;/table&gt;
  &lt;/form&gt;';
  }
  ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is the big of php that actually deletes the row</p>
  
  <hr>
  
  <pre><code>&lt;?php
  require_once('db_login.php');
  //EXTRACT THE INFORMATION FROM THE WEB FORM
  $mt_serial = intval($_POST['mt_serial']);
  // Create connection
  $conn = new mysqli($servername, $dbusername, $dbpassword, $dbname);
  if ($conn-&gt;connect_error) {
  die("Connection failed: " . $conn-&gt;connect_error);
  } 
  
  $del_result ="UPDATE masstimes SET mt_deleted = 1 where mt_serial =     $mt_serial";
  $conn-&gt;query($del_result);
  echo $del_result;
  ?&gt;
  </code></pre>