Uncaught Error: Call to a member function bind_param() on null

please help me out with this error

Call to a member function bind_param() on null

anytime i try to run it on my localhost it says

Warning: Undefined variable $stm in C:\xampp\htdocs\pmlc\cryptedlogin\login.php on line 11

and also says

Fatal error: Uncaught Error: Call to a member function bind_param() on null in C:\xampp\htdocs\pmlc\cryptedlogin\login.php:11 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pmlc\cryptedlogin\login.php on line 11

my code is

<?php
    $username = $_POST['username'];
    $password = $_POST['password'];
    
    //database connection here
    $con = new mysqli("localhost","root","","demo");
    if($con->connect_error){
        die("faild to connect: ".$con->connect_error);
    }else {
        $stmt = $con->prepare("select *from loginform where username =?");
        $stm->bind_param("s", $username);
        $stmt->execute();
        $stmt_result = $stmt->get_result();
        if($stmt_result->num_row > 0){
            $data = $stmt_result->fetch_assoc();
            if ($data['password']=== $password) {
                echo "<h2>Login successfully</h2>";
            }else {
            echo "<h2>invalid email or password</h2>";
    }
        }else {
            echo "<h2>invalid email or password</h2>"; 
        }
    }
?>
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum