Am I doing something wrong with the code?
$stmt = $conn->prepare("SELECT nome FROM users WHERE nome = ?");
$stmt->bind_param('s', $_POST['name']);
$stmt->execute();
if ($stmt->affected_rows > 0) {
    if (verify_psw($psw_p, $nome) == true) {
        return true;
    }
} else {
    echo "<script>alert('nome errato');</script>";
}
here's the function that connect to the db:
function connect()
{
    $dbhost = "localhost";
    $dbuser = "site";
    $dbpass = "";
    $db = "my_site";
    $conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n". $conn -> error);
    return $conn;
}
 
     
    