<?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 } ?>
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
Change
if($data['status']='pending')
To
if($data['status']=='pending')
Edit:
if($data['status'] === 'pending')
Will check the value as well as types.
For more info, click Comparison Operators