php - CI ActiveRecord 中的组合条件

标签 php mysql codeigniter activerecord

我想做一个像这样的sql查询

select * where x = 10 and (y=12 or h=15)

如何以 CI ActiveRecord 格式实现这一点?

最佳答案

参见Active record引用

$where="x = 10 and (y=12 or h=15)";
$this->db->select('*');
$this->db->from('mytable');
$this->db->where($where);
$query = $this->db->get();

关于php - CI ActiveRecord 中的组合条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18099990/

相关文章:

php - CS、JS、图片等静态文件应该放在Codeigniter文件夹结构的什么位置?

php - Codeigniter 事务测试失败

javascript - 如何使用嵌套 HTML <input[name =""]> 作为 JavaScript 对象/数组键

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

mysql - 如何重命名此 SQL 片段中的多个列?

php - CodeIgniter 消息:mysqli::real_connect(): (HY000/2002):连接超时,服务器中出现错误

php - sql将两个表单连接到数据库

php - 从多个表中删除(如果有)

php - 为什么我的更新查询创建新行?

php - CodeIgniter + mod_rewrite url重写错误