我将代码从测试服务器移动到 hostgator 并收到此错误:
Fatal error: Call to undefined method mysqli_result::fetch_all()
我已经用 fetch_all 编写了这么多行,要全部改变它会很烦人。
解决此问题的最简单方法是什么?
示例 php:
function get_all_map_users() {
$mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
if ($mysqli->connect_error) {
//Failed to connect
die('Could not connect: ' . $mysqli->connect_error . ' - ' . $mysqli->connect_errno);
}
//Success
$result = $mysqli->query("SELECT * FROM names");
$rows = $result->fetch_all(MYSQLI_ASSOC);
//Clear result set
$result->free();
//End mysql query
//Close mysqli connection
$mysqli->close();
return $rows;
}