查看
<form action="<?php echo base_url()?>user/category" method="post">
<label>Hr</label>
<input type="checkbox" name="check[]" value="hr"/>
<label>Developer</label>
<input type="checkbox" name="check[]" value="Developer"/>
<label>Designer</label>
<input type="checkbox" name="check[]" value="Designer"/>
<label>CEO</label>
<input type="checkbox" name="check[]" value="CEO"/>
<label>Developer/Designer</label>
<input type="checkbox" name="check[]" value="Developer,Designer"/>
<input type="submit" value="submit"/>
模型
function category($data){
$this->db->select("*");
$this->db->from("data");
$this->db->where_in('profile',$data);
$query = $this->db->get();
return $query->result_array();
}
控制器
function category(){
$details =$this->input->post('check');
if(!isset($details)){
$this->Ulogin();
}
else
{
$details =$this->input->post('check');
// var_dump($details);
$data = $this->user_model->category($details);
var_dump($data);
}
}
当我搜索developer/designer
之类的单个字符串时,它正在运行,但它没有返回其字符串列如developer
,designer
的字符串。我想要
当我搜索开发者时,它应该返回其个人资料为developer
或developer
,designer
两者。
答案 0 :(得分:1)
使用类似查询
$this->db->like('keywords',$keywords);
$this->db->where("condition","condition");
$query = $this->db->get("tbl_name");