我刚将所有网站文件和数据库移到了网站主机上,尝试运行其中一个网页时遇到以下错误:
Call to undefined method mysqli_stmt::get_result()
之前我看到过这个问题,它与未安装的mysqlnd驱动程序有关。所以我联系了网络主机,他们说使用以下PHP安装了mysqli和mysqlnd:
<?php
if (extension_loaded('mysqlnd'))
echo 'extension mysqlnd is loaded'; // WORKED
if (extension_loaded('mysqli'))
echo 'extension mysqli is loaded'; // WORKED
?>
这是我试图运行的PHP:
<?php
$cxn = mysqli_connect("localhost", "my_username", "my_password", "my_database") or die ("Couldn't connect to the server. Please try again.");
$id = 0;
$stmt = $cxn->prepare('SELECT value FROM test WHERE id = ?');
$stmt->bind_param('i', $id);
$stmt->execute();
$result = $stmt->get_result();
echo $result->num_rows;
?>
请帮忙!
答案 0 :(得分:2)
mysqlnd实际上不是扩展名,而是扩展名所使用的库。因此,您的主机必须使用--with-mysqli=mysqlnd