Getting Call to a member function stmt_init() on a non-object

this is my code


function dbConn(){

$conn = new mysqli('$db_host','$db_user','$db_pass',$'db_name');
return $conn;
}
$conn = dbConn();




function verifyUser($un){

$sql = 'select * from client where email = ?';

$stmt = $conn->stmt_init();
if ($stmt->prepare($sql)){
$stmt->bind_param('s', $un);
$stmt->execute();


if($stmt->fetch()) {
 $stmt->close();
 return true;
 }
 
}
}

the database information for the connection is correct from an include file. But I still get the error.

thanks

the error is telling you that verifyUser() does not know about $conn.

Either tell verifyUser that $conn a global variable it can now use, or pass it in via an argument:


function verifyUser($un, $conn)

sorry, no exp with mysqli.