I'm using login feature with session and SQL, in my sql there is a column called first name, I'm trying to find out how can I show after the login Hello $firstname which is not working and not Hello $username which is working and show the username. Thanks for your help.
<?php 
session_start();
require('connect.php');
if (isset($_POST['username']) and isset($_POST['password']) and isset($_POST['firstname'])){
    $username = $_POST['username'];
    $password = $_POST['password'];
    $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'";
    $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
    $count = mysqli_num_rows($result);
    if ($count == 1){
        $_SESSION['username'] = $username;
    }
    else{
        $fmsg = "Invalid Login Credentials.";
    }
}
if (isset($_SESSION['username'])){
    $username = $_SESSION['username'];
    echo "Hello " . $username . "
    ";
    echo "This is the Members Area
    ";
    echo "<a href='logout.php'>Logout</a>";
}else
    header('location: login.php');
?>
 
     
     
     
    