CI Active记录无法在Google Chrome中使用?

时间:2015-07-29 08:18:02

标签: php codeigniter

我在CI中写这个查询。

$this->db->select("initiation.*, project.projectname,subproject.subprojectname, concat(employee.firstname,' ',employee.lastname) as 'name'")
                ->from('initiation')
                ->join('project','initiation.projectid=project.id')
                ->join('employee','initiation.leaderid = employee.id')
                ->join('subproject','initiation.subprojectid=subproject.id','left');
$query = $this->db->get();
return $query->result();

它在Firefox中运行良好,但在Chrome中收到此错误消息。

  

致命错误:在非对象上调用成员函数result()

请问好吗?

2 个答案:

答案 0 :(得分:1)

尝试使用result_array();确保您有自动加载的数据库库

$this->db->select("initiation.*, project.projectname,subproject.subprojectname, concat(employee.firstname,' ',employee.lastname) as 'name'")
                ->from('initiation')
                ->join('project','initiation.projectid=project.id')
                ->join('employee','initiation.leaderid = employee.id')
                ->join('subproject','initiation.subprojectid=subproject.id','left');
$query = $this->db->get();

if ($query->num_rows() > 0) {
return $query->result_array();
} else {
return false;
}

答案 1 :(得分:1)

hostname