【发布时间】:2014-04-26 15:17:31
【问题描述】:
这是我做的一个搜索功能,它获取搜索词并显示正常。 HM_Jobs 有 3 个 JobStatus 选项: Open、Accepted 或 Complete。
但是,当我运行它时,搜索还会从 Accepted 和 Complete 行中提取结果,为什么 WHERE 语句没有阻止这种情况发生?
function search_jobs($search) //This function checks a search term against the job title and description.
{
$this->db->select('*');
$this->db->from('HM_Jobs');
$this->db->like('JobTitle',$search);
$this->db->or_like('JobDescription',$search);
$this->db->where('JobStatus','Open');
$query = $this->db->get();
return $query->result();
}
【问题讨论】:
-
尝试 echo $this->db->last_query() 查看您的查询
标签: php mysql sql codeigniter