调用未定义的方法 mysqli_stmt::fetch_array()
我收到上述错误消息,您能找出原因吗?
$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->execute();
if($result != false){
$dbArray=$result->fetch_array();
I'm getting the above error message, could you find out why?
$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->execute();
if($result != false){
$dbArray=$result->fetch_array();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要确保 PHP 是使用内置 mysqli 进行编译的(例如 --with-mysqli)。或者,如果它作为扩展单独编译,您需要确保将其加载到适当的 php.ini 文件中(您可以通过 phpinfo() 检查)。
另外,我假设您正在使用:
作为示例,但对于其他偶然发现这一点的人来说,这可能是一个可怕的想法。
You need to make sure PHP is compiled with mysqli built-in (e.g. --with-mysqli). Alternatively, if it's compiled separately as an extension, you need to make sure you're loading it in the appropriate php.ini file (you can check via phpinfo()).
Also, I presume you're using:
for the sake of example, but for anyone else stumbling across this, that's potentially a horrible idea.