Hi folks,
This issue has me baffled with days.
I have a query string which works fine. The idea is to display the name of the logged in user, with SESSION. However, if I use the query string without LIMIT 1 on the end, the header area vanishes. If I put it back in, it appears again.
Also, I have 2 users registered for testing. But no matter what account I login with, it still shows the same name.
Here is the area of code that is playing up, including the HTML area where the name of the logged in user is displayed.
include 'templates/header.php';
$result = mysqli_query($mysqli, "SELECT * FROM admin_users LIMIT 1");
if ($row = mysqli_fetch_array($result)) {
include 'templates/navbar.php';
$_SESSION['fname'] = $row['fname'];
?>
<div class="dcm-content-wrapper">
<div class="dcm-content">
<h1><i class="fa fa-home"></i> Dashboard</h1>
<p>Hello <?php echo $_SESSION['fname']; ?> You are logged in as Admin!</p>
<?php
}
?>
Please note that SESSION_START() is in the header.php file.
Any help is greatly appreciated.