我做的方法来fecth从数据库中的数据表,我使用的是MySQL
和PHP ver. 5.6
,这是我的代码:遇到错误信息 - 调用未定义的方法mysqli_result :: fetch_all()
public function fetch($table, $notation = null, $where = null) {
if ($notation != null) {
$sql = "SELECT $notation FROM $table";
} else {
$sql = "SELECT * FROM $table";
}
if ($where != null) {
$sql .= " WHERE $where";
}
$query = $this->connection->query($sql) or die ($this->connection->error);
return $query->fetch_all(MYSQLI_BOTH);
}
当我尝试脱机访问此方法时,它完美地工作,但是当我尝试在webhost上访问它时,我收到了错误消息:Call to undefined method mysqli_result::fetch_all()
而我正在使用相同的PHP
版本。
有人可以帮我解决这个问题吗?我会感激它的。
可能重复的[mysqli fetch \ _all()不是有效函数?](http://stackoverflow.com/questions/6694437/mysqli-fetch-all-not-a-valid-function) – Phiter
不,我我的意思不是。我的问题不同 – Arta