0


I make method to fecth data table from database, I'm using MySQL and PHP ver. 5.6, and this is my code :

public function fetch($table, $notation = null, $where = null) {
        if ($notation != null) {
            $sql = "SELECT $notation FROM $table";
        } else {
            $sql = "SELECT * FROM $table";
        }
        if ($where != null) {
            $sql .= " WHERE $where";
        }
        $query = $this->connection->query($sql) or die ($this->connection->error);
        return $query->fetch_all(MYSQLI_BOTH);
    }

when i try to access this method offline, it's work perfectly, but when i try to access it on webhost i've got error message : Call to undefined method mysqli_result::fetch_all() whereas i'm using the same PHP version.
could someone help me to solve this problem ? i would be grateful for it.

PHP extensions on my server

Arta
  • 15
  • 3
  • 8
  • 1
    Possible duplicate of [mysqli fetch\_all() not a valid function?](http://stackoverflow.com/questions/6694437/mysqli-fetch-all-not-a-valid-function) – Phiter Sep 14 '16 at 02:56
  • No, i'm mean not. my problem different – Arta Sep 14 '16 at 03:05

1 Answers1

0

Your server needs to not only have the same version of PHP, but also the same PHP extensions installed. It looks like you're using the MySQLi extension, which needs to be installed on your server. The process for doing this will vary greatly depending on what your hosting situation is -- try googling for "install mysqli on [cpanel/VPS/whatever you're using]".

Hayden Schiff
  • 3,280
  • 19
  • 41
  • Yes! i have same PHP extensions, but i still get error message. – Arta Sep 14 '16 at 02:58
  • If the mysqli_result::fetch_all() method is undefined, you definitely do not have the MySQLi extension on the server. Double check that you indeed have 'mysqli', and not just 'mysql' and/or 'pdo_mysql'. – Hayden Schiff Sep 14 '16 at 02:59