<?php
include('connect.php');
$query=mysqli_query($con,"select * from registration");
while($data=mysqli_fetch_array($query)) {
$a15=$data['status'];
?>
<tr>
<td><?php echo $data['name']; ?></td>
<td><?php echo $data['email']; ?></td>
<td><?php echo $data['contact']; ?></td>
<td><?php echo $data['city']; ?></td>
<td><?php echo $data['status']; ?></td>
<td>
<?php
if($data['status']='pending') { ?>
<a href="approve.php?id=<?php echo $data['id'];?>"><button Class="btn btn-primary btn-sm">Approve</button></a>
<?php } else { ?>
<a href="approve.php?id=<?php echo $data['id'];?>"><button Class="btn btn-success btn-sm">Approved</button></a>
<?php } ?>
<a href="delete.php?uid=<?php echo $data['id'] ?>"><button Class="btn btn-danger btn-sm">Delete</button></a>
</td>
</tr>
<?php } ?>
This code is to print "approve" if user is not approved and print "approved" if user is already approved, but it's not working, showing approve in all cases