【问题标题】:Uncaught Error: Call to undefined method mysqli_stmt::get_result() in mamp未捕获的错误:调用 mamp 中未定义的方法 mysqli_stmt::get_result()
【发布时间】:2016-06-24 09:32:53
【问题描述】:

我在 Windows 上运行 MAMP。在 php.ini 文件中启用了 php_mysqli.dll。

除此之外,在 php info 中它说 mysqlnd 已启用:

这是我的 php 的样子:

$connection = connect();
if($stmt = $connection->prepare("SELECT * FROM `users` WHERE `email` = '?'")){
    $stmt->bind_param("s", $email);
    $stmt->execute();
    $result = $stmt->get_result();
}

$result = $stmt->get_result() 行抛出错误

PHP 致命错误:未捕获错误:调用未定义方法 mysqli_stmt::get_result()

猜猜为什么get_result() 不起作用?

这与已经提出的问题不同,因为所有解决方案都提到未启用 mysqlind,尽管在我的情况下是启用的。

【问题讨论】:

  • 我的解决方案:停止使用 MAMP。

标签: php mysql mysqli mamp mysqlnd


【解决方案1】:

如果您切换到 PDO,则可以改用 fetchAll。 PDO 优于 mysqli 有几个原因,其中之一包括在执行之前将数组作为参数传递的能力。

【讨论】:

    【解决方案2】:

    您可能可以从here: 下载 php 安装并使用 MAMP php 目录作为安装位置。

    【讨论】:

    • 欢迎来到 Stack Overflow!虽然这在理论上可以回答问题,it would be preferable 在此处包含答案的基本部分,并提供链接以供参考。
    • 谢谢,我会在以后的活动中考虑到这一点
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-11
    • 1970-01-01
    • 2014-01-09
    相关资源
    最近更新 更多