本文介绍了查询多个赞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只看到or_like().是否可以查询两个不同的赞",并且都是必需的?

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();

推荐答案

您可以将数组传递给$this->db->like(),这将产生多个AND:

You can pass an array to $this->db->like()which will produce multiple ANDs:

$array = array('product_key.client_name' => $filter_name, 'product_key.status' => $filter_status);
$this->db->like($array); 

这篇关于查询多个赞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:10