title: Update mysql database using a button in a table in PHP
body: <p>Hello I'm trying to update a column in my mysql table and I can't get it working.</p>
  
  <p>When I'm trying to click confirm, it doesn't change anything.</p>
  
  <p>orders.php</p>
  
  <pre><code>&lt;?php while ($row = mysqli_fetch_array($results)) { ?&gt;
      &lt;tr&gt;
  
          &lt;td&gt;&lt;?php echo $row['fullname']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['address']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['mobile']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['order_item']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['quantity']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['total_amount']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['payment']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['status']; ?&gt;&lt;/td&gt;
          &lt;td&gt;
              &lt;a href="vieworders.php?pending=&lt;?php echo $row['id']; ?&gt;" class="edit_btn"  onclick="return confirm('Update status?');"&gt;Pending&lt;/a&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="vieworders.php?confirm=&lt;?php echo $row['id']; ?&gt;" class="del_btn" onclick="return confirm('Update status?');"&gt;Confirm&lt;/a&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p> </p>
  
  <p>admin.php</p>
  
  <pre><code>if (isset($_POST['pending'])) {
  
  $pending = "Pending";
  $id = $_POST['id'];
  mysqli_query($db, "UPDATE order_information SET status='$pending' WHERE id=$id");
  array_push($success, "Update SUCCESS");
  }
  
  if (isset($_POST['confirm'])) {
  
  $confirm = "Confirm";
  $id = $_POST['id'];
  mysqli_query($db, "UPDATE order_information SET status='$confirm' WHERE id=$id");
  array_push($success, "Update SUCCESS");
  }
  </code></pre>