PHP Fatal error: Call to undefined method mysqli_stmt::get_result()

I had this error message when I deployed my PHP website to my cPanel PHP hosting company. This message was displayed on all the pages using “get_result()” on a mysqli statement.

PHP Fatal error: Call to undefined method mysqli_stmt::get_result()

Apparently mysqlnd driver is required and for this you need to uncomment “extension=php_mysqli_mysqlnd.dll” in php.ini; and restarted Apache and MySQL services.

Unfortunately, not all hosts, and not all installations of PHP 5.3, have mysqlnd compiled and installed with PHP. PHP 5.4 has mysqlnd compiled in by default.

If you are on a shared host, ask your host if they can offer you a version of PHP 5.3 with mysqlnd compiled in, or upgrade you to PHP 5.4 where mysqlnd is compiled by default.

Note: Sometimes, even if the right version of PHP is installed and compiled with mysqlnd, mysqlnd might be disabled by the hosting company. If it is disabled and they are not enabling it for you, you can either try using bind_result()/fetch() solution instead of get_result() or change your hosting provider to another who can provide you with mysqlnd driver.

You can check if this driver is disabled or not. For this, create a 1-line php file “<?php phpinfo(); ?>” execute this file on your host (by simply browsing to this page) and search for “mysqlnd” in “Configure Command” section.

Hope this helps.
Donate some blood from time to time,
Serdar

Leave a Reply

Your email address will not be published. Required fields are marked *