I have this function on my function.php
function getPassword($username, $conn){
if ($stmt2 = mysqli_prepare($conn, "SELECT data FROM xf_user_authenticate WHERE username = ?")){
mysqli_stmt_bind_param($stmt2, "s", $username);
mysqli_stmt_execute($stmt2);
mysqli_stmt_bind_result($stmt2, $password);
mysqli_stmt_fetch($stmt2);
mysqli_stmt_close($stmt2);
$password = substr($password, 22, -3);
return $password;
}
}
And I have a check.php file that's give me this error
Notice: Undefined variable: username
Notice: Undefined variable: conn
I go with global $username but the selection from database not work. Why its give me this error?