public function job_fetch($key)
{
$this->db->select('*');
$this->db->from('job');
$where = "FIND_IN_SET(".$key.", job_title) and FIND_IN_SET(".$key.", city)";
$this->db->where($where);
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
在这段代码中,我传递了一个变量$key
,其中$key
是一个数组,看起来像Array ( [0] => java [1] => developer [2] => hibernate [3] => struts [4] => in [5] => mumbai [6] => noida [7] => delhi
,我想通过job_title
和{ {1}}如果值位于city
中,那么我该如何解决?请帮助我。
谢谢
答案 0 :(得分:0)
public function job_fetch($key)
{
$this->db->select('*');
$this->db->from('job');
$this->db->where("FIND_IN_SET(".$key.", job_title)");
$this->db->or_where("FIND_IN_SET(".$key.", city)");
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
答案 1 :(得分:0)
这是在代码初始化器中WHERE something AND something
的操作方式:
$this->db->where("FIND_IN_SET(".$key.", job_title)");
$this->db->where("FIND_IN_SET(".$key.", city)");