Reputation: 677
I have a custom query like this
SELECT `wo_number`,`request_date`,`wo_type`,`requestor`
FROM `work_orders`
WHERE CONCAT(",", `assigned_to_enggs`, ",") REGEXP ",(21),"
It works fine for me I want to use it in Codeigniter Active Record. I have tried something like
$this->db->select('wo_number,request_date,wo_type,requestor')
->from('work_orders')
->where("CONCAT(',', assigned_to_enggs, ',') REGEXP ',(21),'");
Don't know what I am doing wrong in syntax. can someone guide me. Thanks
Upvotes: 0
Views: 231
Reputation: 84
Please try below case in where and use result() for get result array
$this->db->select('wo_number,request_date,wo_type,requestor');
$this->db->where("CONCAT(',', assigned_to_enggs, ',') REGEXP ',(21),'", NULL, FALSE);
$this->db->select->from('work_orders');
$query = $this->db->get()->result();
If not work than you also write query like below in codeigniter.
$query = $this->db->query('YOUR QUERY HERE');
$query->result()
Upvotes: 1