title: How to update single row in PHP?
body: <p>I have 2 buttons, approve and reject to update booking status.
  I am lost when trying to pass value to approve_booking.php.
  Have no idea how to update single row according to bookingID. Need help on coding!!!</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;head&gt;
  &lt;script src="jquery-latest.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="jquery.tablesorter.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function() {
  $("#myTable").tablesorter({widgets: ['zebra']});
  });
  
  $(document).ready(function() 
  { 
      $("#myTable").tablesorter(); 
  } 
  );
  
  $(document).ready(function() 
  { 
      $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); 
  } 
  );
  &lt;/script&gt;
  &lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
  &lt;link href="stylelogin.css" rel="stylesheet" type="text/css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="form1" method="post" action="approve_booking.php" &gt;
  &lt;?php
  
  $db = new mysqli("localhost", "root", "", "eventdb");
  
  $query = "SELECT customer.companyName, customer.contactName,eventinfo.eventTitle,boothAlias,date, testbook.bstatus, testbook.username, bookingID  from eventinfo, testbook, customer where testbook.username=customer.username AND testbook.eventID=eventinfo.eventID";
  
  $result = $db-&gt;query($query, MYSQLI_STORE_RESULT);
  
  $o = '&lt;table id="myTable" class="tablesorter" width="660px"&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Company Name&lt;/th&gt;&lt;th&gt;Contact Name&lt;/th&gt;&lt;th&gt;Event&lt;/th&gt;&lt;th&gt;Booth&lt;/th&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Status&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;';
  
  while(list($companyName, $contactName, $eventTitle, $boothAlias, $date, $bstatus,$bookingID) = $result-&gt;fetch_row()) {
  
  if($bstatus==0){
      $status="Pending";
  }else if($bstatus==1){
      $status="Successful";
  }else{
      $status="Reject";
  }
  
  
  $o .= '&lt;tr&gt;&lt;td width="120px"&gt;'.$companyName.'&lt;/td&gt;&lt;td width="120px"&gt;'.$contactName.'&lt;/td&gt;&lt;td width="180px"&gt;'.$eventTitle.'&lt;/td&gt;&lt;td width="70px"&gt;'.$boothAlias.'&lt;/td&gt;&lt;td width="170px"&gt;'.$date.'&lt;/td&gt;&lt;td width="70"&gt;'.$status.'&lt;/td&gt;&lt;td width="100"&gt;&lt;input width="100px" name="APPROVED" type="submit" id="APPROVED" value="Approve"&gt; &lt;input width="100px" name="REJECT" type="submit" id="REJECT" value="Reject"&gt;&lt;/td&gt;&lt;/tr&gt;';
  }
  
  $o .= '&lt;/tbody&gt;&lt;/table&gt;';
  
  echo $o;
  ?&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>approve_booking.php</p>
  
  <pre><code>&lt;?php
  
  mysql_connect("localhost", "root", "") or die (mysql_error());
  mysql_select_db("eventdb") or die (mysql_error());
  
  if(isset($_POST['APPROVED']))
      {
  
          $query2 = "UPDATE testbook SET bstatus ='0' WHERE bookingID='$_POST[booking]'";
              $result2 = @mysql_query($query2);
      }
  
  
  if (isset($_POST['REJECT']))
      {
          $query3 = "UPDATE testbook SET bstatus ='2' WHERE bookingID='$_POST[booking]'";
              $result3 = @mysql_query($query3);
  
      }
  
  
  
  ?&gt;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/0KGLB.jpg" rel="nofollow">http://i.stack.imgur.com/0KGLB.jpg</a></p>