Researching, looking on stackoverflow, looking through Google, I have found several people with the same problem, and the solution generally is "Available only with mysqlnd."

And so I look around and poked at some code, but as far as I can tell, mysqlnd IS enabled on my server. So that is why I do not believe this is a duplicate.

$id = $stmt->get_result();

That line of code, for whatever reason, seems to be causing a hiccup in my application that works perfectly on my local XAMPP server. I am figuring it's some sort of issue with my public server configuration, but I cannot figure out what.

PHP is throwing this error:

[18-Mar-2014 15:39:27 America/Denver] PHP Fatal error:  
Call to undefined method mysqli_stmt::get_result() in 
/home/PATH/PAGE.php on line 47

Again, my code works fine on my local server. Here's some snapshots of my phpinfo()...

MySQLi Seems to Exist...

MySQLnd Seems to Exist...

And just for good measure, my PHP version is 5.4.22. And, finally, running php -i | grep mysqlnd in system console gives me mysqlnd => enabled.

So... What's up? What am I missing? Thankyou for your consideration. I hope this can help others along the way, too. More code (as requested)...

$mysqli = new mysqli('localhost', 'usr', 'pass', 'table');
$chkid = "SELECT * FROM `students` WHERE student_id = ? LIMIT 1";
if ($mysqli->connect_error) { //We'll catch an error or two here.
  die("{CNCT}");
} 
$arrays = json_decode($_POST['data'], true); //Here, we take the JSON string and create PHP arrays
for ($x=0; $x<=((count($arrays))-1); $x++) { //We count the array
  $stmt = $mysqli->prepare($chkid);
  $inputz = ($arrays[$x]['id']);
  $stmt->bind_param("s", $inputz);
  $stmt->execute();
  $id = $stmt->get_result(); //THIS LINE
  $stmt->close();
  $row = $id->fetch_array(MYSQLI_NUM);
}

I do hope I appropriately cut out everything I needed to without screwing up the code. It is working on my local XAMPP server.

有帮助吗?

解决方案 2

After trying many things, I rebuilt Apache (in WHM, using EasyApache) with MySQL (NOT MySQL of the system) and MySQL Improved (MySQLi). Previously I had used a combination of MySQL (of the system) and MySQL Improved. After the build completed, everything was working like magic.

Thanks everyone!

其他提示

It requires not only mysqlnd presence just by itself, but also mysqli has to be built specifically with mysqlnd support. To do so, PHP has to be built with configuration option

--with-mysqli=mysqlnd

in your phpinfo output, mysqlnd has to be mentioned under Client API library version item in mysqli section:

Good: enter image description here

Not good: enter image description here

I've no idea about XAMPP though, as I always build whole servers manually. It seems you need to look for another version or another distribution.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top