如何修复:致命错误:调用未定义的方法mysqli_result :: fetch_all()...?

时间:2014-04-11 23:21:26

标签: php mysqli

我目前正在运行PHP 5.5.10,我不确定为什么会收到以下错误:

Fatal error: Call to undefined method mysqli_result::fetch_all()

这是我的代码:

<?php
require_once('db_connect.php');

if ($result = $db->query("SELECT * FROM user_settings")) {

if ($count = $result->num_rows) {
echo '<p>', $count, '</p>';
$rows = $result->fetch_all(MYSQLI_ASSOC);


echo '<pre>', print_r($rows), '</pre>';

 }
} else {
    die('There was an error with the MySQL Query: ' . '<br />' . '<b>'.$db->error.'</b>');
}
?>

db_connect.php

<?php
error_reporting(1);
require_once('db_config.php');

$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);

if ($db->connect_errno) {
    die('Sorry, we are currently experiencing some problems.');
}

 ?>

为什么我遇到此错误?是与mysqlnd有关吗?如果是这样,我该如何解决这个问题?

0 个答案:

没有答案