Reputation: 866
All I see is or_like()
. Is it possible to query two different 'likes' and both are mandatory?
return $this->db
->select('product_key.contact_email, product_key.contact_number, product_key.client_name, product_key.batch_code, product_key.status, product_key.key, payment.paymentdate, product_key.id, payment.notified')
->from('product_key')
->limit($limit,$offset)
->like('product_key.client_name', $filter_name)
->like('product_key.status', $filter_status) //Second like ('AND LIKE' maybe?)
->where('status', 'purchased')
->select_max('paymentdate','latest_payment')
->join('payment', 'payment.keyid=product_key.id', 'left outer')
->order_by('client_name', "asc")
->group_by('product_key.id')
->get()
->result();
Upvotes: 1
Views: 83
Reputation: 866
I just added a condition to show an alert if either or both are missing so it won't output anything. Thanks for the help guys! :)
Upvotes: 0
Reputation: 3253
You can pass an array to $this->db->like()
which will produce multiple AND
s:
$array = array('product_key.client_name' => $filter_name, 'product_key.status' => $filter_status);
$this->db->like($array);
Upvotes: 1