PHP Fatal error: Call to undefined function mysqli_stmt_get_result()

后端 未结 5 1258
小鲜肉
小鲜肉 2020-11-28 15:33

I keep getting the error PHP Fatal error: Call to undefined function mysqli_stmt_get_result(). I am using PHP version 5.6 and have enabled the extension mysqlind in my host

相关标签:
5条回答
  • 2020-11-28 15:50

    Just check your database table name on your server if it match on your php code. On the right side of your server sql admin you can find this links. Click the "create php code" then use the exact table name shown like this:
    $sql = "SELECT * FROM 'users' WHERE id=?"; links image On my part the code looks like this: table name image $sql = "SELECT * FROM 'pending_products' WHERE id=?";

    0 讨论(0)
  • 2020-11-28 15:57

    Your are using procedural way of Getting Data.

    If possible you may use object oriented way so not need to enable nd_mysqli on server.

    $sql = "SELECT * FROM users WHERE id=?"; // SQL with parameters
    $stmt = $conn->prepare($sql); 
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $result = $stmt->get_result(); // get the mysqli result
    $user = $result->fetch_assoc(); // fetch data 
    
    0 讨论(0)
  • 2020-11-28 16:11

    To prevent others from hours of screaming trying to figure out why this does not work when you have the mysqlnd native driver enabled. It is because you need to make sure you enable both native drives. Both mysqlnd and nd_mysqli need to be enabled on your server if you wish to use this functionality.

    Otherwise just enabling the mysqlnd native driver does not include the mysqli_stmt_get_result function as this apparently resides in the nd_mysqli native driver. Unfortunately, most documentation only ever talks about the mysqlnd native driver.

    Once you enable both native drivers this function works as documented.

    Oh and on my hosting server you need to disable/uncheck mysqli to enable nd_mysqli.

    0 讨论(0)
  • 2020-11-28 16:11

    I had the same issue ("PHP Fatal error: Call to undefined function mysqli_stmt_get_result()")and all it took was to change the version of php the server was auto set too ie 5.6 to 7.2, and to make sure the nd_mysqli is checked. Note that mysqlnd is contraindicated in the place of nd-mysqli.

    Steps:
    Find the change php version section in cpanel
    Choose highest version of php at current 7.2
    Ensure nd_mysqli is checked from list of extensions
    In case of any error try un-checking mysqlnd

    0 讨论(0)
  • Do you have the mysqlnd driver properly installed? Per a comment in the Manual:

    If you don't have mysqlnd installed/loaded whatever, you will get an undefined reference when trying to call "mysqli_stmt_get_result()".

    Also, there are discussions about this issue here and here.

    Lastly, here's a forum discussing info pertaining to using the driver with cpanel that you may find useful.

    0 讨论(0)
提交回复
热议问题