php - 如何在 codeigniter 中使用 Find_IN_SET?
问题描述
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
city
$key
谢谢你
解决方案
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;
}
推荐阅读
- widget - 孩子们排成一排
- react-redux - 仅当三元表达式直接在 render() 方法中时,组件才会重新渲染
- c# - how do i create a Generic List for the class batch and inside class batch i want to put student class information
- r - Multiple shiny apps used for shiny dashboard inputs and deployment on different droplets
- java - 在java中验证(mm / yyyy)类型的日期格式
- linux - Makefile 使用条件函数
- python - neo4j - 改进 Cypher 查询
- spring-data-r2dbc - ClassNotFoundException:org.springframework.data.repository.query.QueryMethodEvaluationContextProvider
- css - amp-story 能否与 Normalize.css 和 Basscss 完全兼容?
- operating-system - 什么是 Windows“wmic os 获取序列号”命令