开发者

Call to undefined method mysqli_stmt::fetch_array() [duplicate]

This question already has answers here: Call to undefined method mysqli_result::fetch() (2 answers) Closed 9 months ago.

I'm getting the above error message, could you find out why?

$mysqli=new mysqli("localhost", "***", "***","***") or die($mysqli->connect_error);
        
fun开发者_如何学运维ction 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();


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:

global $mysqli;

for the sake of example, but for anyone else stumbling across this, that's potentially a horrible idea.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜