0

I am using prepared statements but I'm experiencing this problem:

Fatal error: Call to undefined method mysqli_stmt::get_result() in ...

I tried it in xampp and get_result(); works perfectly, however I have a dedicated server with cPanel/WHM installed and I get this error. I have installed MYSQLND rebooted the system but still the error occurs.

My Code:

$sqlzprep = $db->prepare("SELECT COUNT(*) FROM table WHERE table1=? AND table2=? AND table3=? AND table4=? AND table5=?");
                $sqlzprep->bind_param("sssss", $list[0], $list[2], $list[3], $list[4], $list[5]);
                $sqlzprep->execute();
                $numrowz = $sqlzprep->get_result();
                $numrowz = $numrowz->fetch_row();

Can somebody please help me?

Paradox
  • 4,602
  • 12
  • 44
  • 88
Lesii
  • 33
  • 7
  • You’re obviously missing the mysqli extension. Install it and activate it in the PHP config. – lxg Jun 28 '15 at 22:30
  • Update your PHP version. [`mysqli_stmt::get_result()`](http://php.net/manual/mysqli-stmt.get-result.php) was added in 5.3.0 – Phil Jun 29 '15 at 00:07
  • @lxg I think if OP didn't have the *mysqli* extension, it would have bailed on `prepare()` or even earlier at `mysqli_connect()` / `new mysqli` (or however OP is creating their connection) – Phil Jun 29 '15 at 00:10

1 Answers1

0

enabled mysql, mysqli, and pdo compatibility by creating

/var/cpanel/easy/apache/rawopts/all_php5

In this file place the following directives:

--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd

and use EasyApache to rebuild your php configurations.

more info here http://olaitanmayowa.com/call-to-undefined-method-mysqli_stmtget_result/

Olaitan Mayowa
  • 703
  • 6
  • 10