【发布时间】:2013-11-08 06:53:53
【问题描述】:
我必须在 codeigniter 中使用 mysql 在一个字段中搜索多个值。下面是我的代码。
在控制器中
public function vpsearch()
{
$data['info'] = $this->psearch_m->emp_search_form();
$this->load->view("employer/result",$data);
}
IN 模型
public function emp_search_form()
{
$skill = $this->security->xss_clean($this->input->post('ps_skills'));
$jrole = $this->input->post('ps_jobrole'));
if ( $jrole !== NULL)
{
return $this->db->get('js_edu_details');
$this->db->like('js_skills','$skill');
}
}
考虑即(../employer/result)
foreach($info->result() as $row)
{
echo $row->js_id."<br/><br/>" ;
}
但是,我得到的是“js_edu_details”表中的所有记录,而不是搜索“技能”的字段。
我哪里出错了?任何帮助 wud b 感谢,thanx 提前。
【问题讨论】:
标签: php mysql codeigniter active-record-query