Why am I getting the following error?
Fatal error: Call 开发者_如何学Pythonto undefined method mysqli_stmt::query()
$mysqli = new mysqli("localhost", "***", "***", "***") or die($mysqli->connect_error);
function checklogin($username, $password)
{
global $mysqli;
$result = $mysqli->prepare("SELECT * FROM users WHERE username = ?");
$result->bind_param("s", $username);
$result->query();
}
Calling $mysqli->prepare()
will return an instance of MySQLi_STMT
, but the MySQLi_STMT
class doesn't have a query()
method. Perhaps you meant execute()
?
精彩评论