user2976078
user2976078

Reputation: 75

Call to undefined method mysqli_stmt::get_result() AND mysqlnd is installed

I have a problem with get_result() function.

The php script on my localhost working well but on the server have this error

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

I searched many times but I didn't find the solution. My code:

$sql=$db->prepare("SELECT * FROM `news` WHERE cat = ? order by id desc limit 10");
$cat=$_GET['cat'];
$sql->bind_param('i', $cat);
$sql->execute();
$result=$sql->get_result();
if($result){
    while ($row = $result->fetch_array()) { echo "something"; }

(Both "mysqli" and "mysqlnd" are installed. )

what i have to do now ?

Upvotes: 0

Views: 1891

Answers (1)

elfensky
elfensky

Reputation: 45

I had this issue on Namecheap's Shared Hosting.

I solved it by switching from mysqli to nd_mysqli module in the PHP Selector in CPanel.

PHP Selector configuration

I was having the same error of get_results() seemingly not existing, but after talking to their support they confirmed it should work.

I kept playing with PHP configuration and ended up getting it to work.

Upvotes: 1

Related Questions