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;
}
In this code, I am passing a variable ie $key
where $key
is an array and it look like Array ( [0] => java [1] => developer [2] => hibernate [3] => struts [4] => in [5] => mumbai [6] => noida [7] => delhi
and I want to fetch data by job_title
and city
if value lies in $key
so how can I fix it? Please help me.
Thank You
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;
}
This is how you do WHERE something AND something
in codeigniter:
$this->db->where("FIND_IN_SET(".$key.", job_title)");
$this->db->where("FIND_IN_SET(".$key.", city)");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.