嗨我在使用之后使用了mysql中的where条件,如果我运行网站获取空白页面。
其实我是QA部门,发展,管理部门的三个部门。
在Mysql中我已经使用where条件来获取QA部门列表但是获得空白页面。
这是我的代码:
控制器:
public function index()
{
$data['records2'] = $this->index_model->get_ourteammembers();
$data['mainpage'] = "our-team";
$this->load->view('templates/template',$data);
}
模型
function get_ourteammembers()
{
$this->db->select('T.*');
$this->db->from('ourteam AS T');
$this->db->where('T.department'='QA Department');
$q = $this->db->get();
if($q->num_rows()>0)
{
return $q->result();
}
else
{
return false;
}
}
答案 0 :(得分:3)
试试这个
function get_ourteammembers()
{
$this->db->select('T.*');
$this->db->from('ourteam AS T');
$this->db->where('T.department','QA Department');
$q = $this->db->get();
if($q->num_rows()>0)
{
return $q->result();
}
else
{
return false;
}
}
答案 1 :(得分:0)
根据CodeIgniter文件,您必须使用','而不是' ='
$this->db->where('T.department'='QA Department');
到
$this->db->where('T.department','QA Department');