Jump to content

Moorcam

Members
  • Posts

    245
  • Joined

  • Last visited

Everything posted by Moorcam

  1. Hi. Thanks for the reply. I have tried even putting WHERE id = $_SESSION['id']; And that also makes the html vanish. Also note, login is working fine. The OP shows the code from the start of index.php after login.
  2. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.