0

I am currently running PHP 5.5.10 and I am not sure why I am receiving the following error:

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

This is my code:

<?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.');
}

 ?>

Why am I experiencing this error? Is it to do with mysqlnd? If so how can I fix the issue?

RobP
  • 8,696
  • 3
  • 19
  • 33
user3481788
  • 161
  • 10
  • 2
    http://stackoverflow.com/questions/11664536/fatal-error-call-to-undefined-method-mysqli-resultfetch-all – random_user_name Apr 11 '14 at 23:22
  • From the [PHP manual](http://www.php.net/manual/en/mysqli-result.fetch-all.php): Available only with mysqlnd. –  Apr 11 '14 at 23:26

0 Answers0