如果标题令人困惑,请道歉。目前,我将其作为get_where函数的一部分:
$query = $this->db->select('*');
$query = $this->db->get_where('Accounts', array('active' => 1));
return $this->result_array($query);
如何添加到 get_where()
语句中以查找包含我告诉它要查找的字符串值的特定列?例如,我希望它也在 AccountKey 列中查找,并返回该列中包含字符串"120-"的所有行,以及 active = 1
.
你可以这样使用,你的查询将变成如下内容:
$query = $this->db
->select('*')
->from('Accounts')
->where('active', 1)
->like('AccountKey', '120-', 'after')
->get();