脚本宝典收集整理的这篇文章主要介绍了php – 需要替代mysqli_fetch_all,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Fatal error: Call to undefined function MysqLi_fetch_all() in /home3/t561257/public_htML/admin/database.PHP on line 49
代码的以下部分是问题所在.
function fetch_rows($queryname) { $result = $this->connection->query($queryname); $row = MysqLi_fetch_all($result,MysqLI_ASSOC); return $row; }
我用以下方式使用它
$next_four_rows = $db_link->fetch_rows($query_four_latest);
$db_link是具有fetch_rows方法的类.
我在我的本地服务器上使用PHP 5.5,因为服务器正在运行5.4.27我真的对如何修复它一无所知
> Recompile PHP with mysqlnd或者可能从Linux发行版的软件包存储库中安装另一个特定的软件包.
>使用简单的循环:
$data = []; while ($row = $result->fetch_assoc()) { $data[] = $row; }
您甚至可以创建兼容性回退,而无需更改所有代码:
if (!function_exists('MysqLi_fetch_all')) { function MysqLi_fetch_all(MysqLi_result $result) { $data = []; while ($data[] = $result->fetch_assoc()) {} return $data; } }
以上是脚本宝典为你收集整理的php – 需要替代mysqli_fetch_all全部内容,希望文章能够帮你解决php – 需要替代mysqli_fetch_all所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。