I do really need some help to explain me about my error. I am new about the mysqli can someone lend me some time to teach me about mysqli?
<?php
if(isset($_POST['txtlogin'])){
$username = $_POST['txtusername'];
    $password = md5($_POST['txtpassword']);
    $stmt = $link->prepare("SELECT username, password FROM users WHERE username=? AND  password=?");
    $stmt->bind_param('ss', $username, $password);
    $stmt->execute();
    $stmt->bind_result($username, $password);
    $stmt->store_result();
    if($stmt->num_rows == 1)  //To check if the row exists
        {
            while($stmt->fetch()) //fetching the contents of the row
              {$_SESSION['Logged'] = 1;
               $_SESSION['username'] = $username;
               echo 'Success!';
               exit();
               }
        }
        else {
            echo "INVALID USERNAME/PASSWORD Combination!";
        }
        $stmt->close();
    }
    else 
    {   
    }
$link->close();
?>
 
    