Reputation:
I have an array like:
$expl = Array([0] => 51465, [1] => 411002);
I want to get all records that contain zip codes like 51465
or 411002
. To get this I tried:
foreach ($expl as $exp) {
$this->datatables->or_like('vendor.zip', $exp);
}
But this is showing me the following error:
Call to undefined method Datatables::or_like()
Can someone please tell me the solution or any alternative way for this?
Upvotes: 0
Views: 429
Reputation: 159
Please use database Codeigniter object db or you can use custom datatables. I would suggest you please use db object.
$this->db->or_like('vendor.zip', $exp);
But you should also use "IN" query.
$names = array(51465, 411002);
$this->db->where_in('vendor.zip', $names); // Here vendor is alias of table name
// Produces: WHERE vendor.zip IN (51465, 411002)
Upvotes: 1