我有以下函数,它总是返回 false。它甚至没有尝试执行该语句,我知道是因为我更改了 $query = "aldfjaf lkjfsk" 并且它没有为我返回错误。有什么建议么?
class Mysql {
private $conn;
function __construct() {
$this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or
die('There was a problem connecting to the database.');
}
function verify_Username_and_Pass($un, $pwd) {
$query = "SELECT *
FROM user_table
WHERE login_username = ? AND login_password = ?";
if($stmt = $this->conn->prepare($query)) {
$stmt->bind_param('ss', $un, $pwd);
$stmt->execute();
if($stmt->fetch()) {
$stmt->close();
return true;
}
}
}