Using get_result with prepared statements

My understanding from reading the PHP literature is that mysqlnd is supposed to be enabled by default in versions after 5.3. I am looking at phpinfo and it says version 5.3.5 but when I try to run a get_result after a prepared statement execute it doesn’t work.

I also have this inside a try-catch enclosure and I am getting no error reporting on it either so it just kills the system.

Any ideas as to what to look for?

This is on a Linux host. I have upgraded a Windows host as a dev machine and loaded the Lounge version of Apache and then the latest PHP and on that system it works great with get_result.


One more comment, I did force an error on the prepare statement and the error capture is working fine

‘get_result’. This function is undefined. What database extention are you using? mysql? mysqli? PDO?


take a look at

PHP: mysqli_stmt::get_result - Manual

Kills the system… as in the white-screen-of-ive-got-a-syntax-error? or outputs-nothing-because-theres-no-results? or…?

Also, the relative code block would be helpful to make sure you’ve not made a head-to-screen error…

Don’t know the answer to that question. It’s not throwing an error, I do know that. And on this system, I have been unable to turn error reporting on for some reason. It is a vhost environment so I don’t want to turn it on in php.ini but I do have the following in .htaccess although the errors part seems to have no effect

AddHandler php5-script .php

Options +FollowSymLinks -Indexes

ErrorDocument 404 /errors31050/404page.html

php_value session.cookie_domain
php_value PHPSESSID

php_value html_errors On
php_value track_errors On
php_value display_errors On
php_value error_reporting E_ALL

RewriteEngine On

Here is the code, and remember, this runs just fine as is in my dev environment

			if (!$prep1->execute()) {throw new Gen_ExtException("link message = " . $this->link->error . " ---- " . $this->msg, 3);}
			if (!$result = $prep1->get_result()) {throw new Gen_ExtException("link message = " . $this->link->error . " ---- " . $this->msg, 4);}
			while ($row = $result->fetch_assoc()) {
				$dataret['data'][] = $row;

After looking at pinfo() in both environments, mysqlnd is not being used on the remote environment. It is on the local environment so that is the problem.