如何在codeigniter查询中使用FIND_IN_SET?

$array = array('classesID' => 6);
$this->db->select()->from($this->_table_name)->where($array)->order_by($this->_order_by);
$query = $this->db->get();
return $query->result();

I need to get the rows where the classesID is 6. Some rows contain 6,5,4. so i need to use FIND_IN_SET query to retrive where the classesID is 6.

Please guide me

Thanks

You can write the query like this.

return $this->db->where('classesID' , '6')->order_by('column_name','desc')->get('table_name')->result_array();

if Need any help comment

Try this

$array = array('classesID' => '5,6,7');
$this->db->select();
$this->db->from($this->_table_name);
$this->db->where("FIND_IN_SET('classesID',".$array['classesID'].")",null,false);
$this->db->order_by($this->_order_by);
$query = $this->db->get();
return $query->result();

'Action history table with studentsIds as comma separated values

I need to get the rows which has student id '4488' and message id '1418'

$id = 1418;
$student_id = 4488;
    this->db->select('id, action_status, updated_on, student_ids');
    $this->db->where('message_id', $id);
    $this->db->where('find_in_set("'.$student_id.'", student_ids) <> 0');
    $this->db->from('actions_history');
    $query = $this->db->get();

It will return a query like

SELECT id, action_status, updated_on, student_ids FROM actions_history  WHERE message_id = '1418' AND find_in_set("4488", student_ids) <>0