I want to display the info of the logged in user aka their ID,firstname,lastname, and so on, after running the code shown below, it shows me everyone else from the DB, and excludes the "user" who's data should be shown.
include("server.php");
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
$sql = "select id, username, fname, lname, email from users WHERE username != '{$_SESSION['username']}'";
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result) > 0 ){
while($row = mysqli_fetch_assoc($result)){
?>
<tr>
<td><?=$row['id']?></td>
<td><?=$row['username']?></td>
<td><?=$row['fname']?></td>
<td><?=$row['lname']?></td>
<td><?=$row['email']?></td>
<br>
</tr>
<?php