Why won't the logged in name display? <p>I'm trying to show a welcome message to the logged in user that says "Hello Jordan" for example. I can't seem to figure out what I'm doing wrong. I'll give below my admin index.php source code and an image of my MySQL database.</p> <p><img src="https://i.stack.imgur.com/Y1oAD.png" alt="MySQL Database"></p> <p><strong>admin index.php</strong></p> <pre><code>&lt;?php session_start(); include_once('../includes/connection.php'); if (isset($_SESSION['logged_in'])) { // Display Index ?&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Jordan CMS&lt;/title&gt; &lt;link rel="stylesheet" href="../assets/style.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;a href="index.php" id="logo"&gt;CMS&lt;/a&gt; &lt;? echo "Hello" . $_SESSION['username']; ?&gt; &lt;br /&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="add.php"&gt;Add Article&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="delete.php"&gt;Delete Article&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="pages.php"&gt;Add Page&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="users.php"&gt;Add Users&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="logout.php"&gt;Logout&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php } else { // Display Login if (isset($_POST['username'], $_POST['password'])) { $username = $_POST['username']; $password = md5($_POST['password']); if (empty($username) or empty($password)) { $error = 'All fields are required!'; } else { $query = $pdo-&gt;prepare("SELECT * FROM users WHERE username = ? AND password = ?"); $query-&gt;bindValue(1, $username); $query-&gt;bindValue(2, $password); $query-&gt;execute(); $num = $query-&gt;rowCount(); if ($num == 1) { // user entered correct details $_SESSION['logged_in'] = true; header('Location: index.php'); exit(); } else { // user entered false details $error = 'Incorrect details!'; } } } ?&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Jordan CMS&lt;/title&gt; &lt;link rel="stylesheet" href="../assets/style.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;a href="index.php" id="logo"&gt;CMS&lt;/a&gt; &lt;br /&gt;&lt;br /&gt; &lt;form action="index.php" method="post" autocomplete="off"&gt; &lt;input type="text" name="username" placeholder="Username" /&gt; &lt;input type="password" name="password" placeholder="Password" /&gt; &lt;input type="submit" value="Login" /&gt; &lt;/form&gt; &lt;?php if (isset($error)) { ?&gt; &lt;small style="color: #AA0000;"&gt;&lt;?php echo $error; ?&gt;&lt;/small&gt; &lt;?php } ?&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php } ?&gt; </code></pre>