Search code examples
phpmysqlmysqlidebianmysqlnd

Can't get mysqli_result::$fetch_all working


I'm trying to get the fetch_all function working with mysqli. I know I need PHP > 5.3 and mysqlnd.

My server runs Debian Wheezy so I have PHP 5.5. I just removed php5-mysql and installed php5-mysqlnd.

phpinfo() shows that mysqlnd is installed, but when I try to use the fetch_all function I still get this error:

Undefined property: mysqli_result::$fetch_all

I call it like this:

$result->fetch_all[MYSQLI_ASSOC]

Am I missing something?


Solution

  • This:

    $result->fetch_all[MYSQLI_ASSOC]
    

    is an array reference. fetch_all is a METHOD.

    it should be

    $result->fetch_all(MYSQLI_ASSOC)
    

    note the change in bracket types.