当我执行以下代码时,我得到标题中描述的错误代码:
function getBrands($b_showAll) {
global $mysql;
if($b_showAll==true) {
$query = $mysql->query("SELECT * FROM producer");
}
else {
$query = $mysql->query("SELECT * FROM producer WHERE (active = 1)");
}
$result = array();
while($row = $query->fetch_array()) {
$brand = new brand();
$brand->name = $row['name'];
$brand->logo = $row['logo'];
$brand->active = $row['active'];
array_push($result, $brand);
}
return $result;
}
如何解决这个问题?