Search code examples
phpmysqlnd

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


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?


Solution

  • 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/