I want to check if a user exists through my address bar using the GET method. if that users exist then echo $username and $firstname. but It display 2 errors. I don't know what's wrong!.
 <?php include ("./trial/header.php"); ?>
<?php
    //we want to perform  http://localhost/test.php?=jude to see if user exists then displays username and first name
    //the table name is users and include username, first_name, last_name, password and email.
if (isset($_GET['u'])) {
    $username = mysqli_real_escape_string($con, $_GET['u']);
    if (ctype_alnum($username)) {
    //check if user exists
    $check = mysqli_query($con, "SELECT username, first_name FROM users WHERE username='$username'");
    //if user exists we want to display username and firstname on the page
    if (mysqli_num_rows($check)===1) {
    $get = mysqli_fetch_assoc($check);
    $username = $get['username'];
    $firstname = $get['firstname']; 
    }
    //if user do not exist we want to to display "The user does not exist"
    else
    {
    echo "The user does not exist";  //no existing users
    exit();
    }
    }
}
?>
    <h2>Profile page for: <?php echo $username;?></h2>;
    <h2>First name: <?php echo $firstname;?></h2>;
 
    