pending_approvals.php
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Transaction ID</th>
<th>Agent Email</th>
<th>Sender</th>
<th>Receiver</th>
<th>Amount</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$trans = "SELECT * FROM transactions";
$get_trans = mysqli_query($db, $trans);
while($row = mysqli_fetch_array($get_trans)){?>
<tr>
<td><?php echo $row['transaction_id']; ?></td>
<td><?php echo $row['agent_email'] ;?></td>
<td><?php echo $row['sender']; ?></td>
<td><?php echo $row['receiver']; ?></td>
<td><?php echo $row['amount']; ?></td>
<td>
<a class="btn btn-success ti-eye" href="view_transaction.php?transaction_id=<?php echo $row['transaction_id']; ?>"></a>
<a class="btn btn-info" href="approve.php?transaction_id=<?php echo $row['transaction_id']; ?>"
onclick="return confirm('Are you sure you would like to confirm this transaction ?');"> Approve</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
approve.php
<?php
include('config.php');
include_once('_header.php');
$transaction_id = $_GET['transaction_id'];
$approve = "INSERT INTO approvals SELECT * FROM transactions WHERE transaction_id = '$transaction_id'";
$run = mysqli_query($db, $approve);
if($approve){
$approved = "UPDATE approvals SET approved = TRUE WHERE transaction_id = '$transaction_id'";
$run = mysqli_query($db, $approve);
}
?>
<?php include_once('_footer.php'); ?>
The transaction & approval tables are similar and my query is just inserting the data from the transaction table but not updating the approved column from 0 to 1 in the approval table