拽拽
管理员组
|
|
CI框架中数据库操作函数$this->db->where() 的使用
CI 框架数据库操作函数 this->db->where() 的使用 1) $this->db->where(‘MATCH (field) AGAINST (“value”)’, NULL, FALSE) 如果把$this->db->where() 接受可选的第三个参数设置为 FALSE, CodeIgniter 将不会为那些包含反勾号的字段名或表名提供保护。 2) $this->db->or_where() 本函数与上面的那个几乎完全相同,唯一的区别是本函数生成的子句是用 OR 来连接的: $this->db->where(‘name !=’, $name); $this->db->or_where(‘id >’, $id); 说明: or_where() 以前被叫作 orwhere(), 后者已经过时。 3) $this->db->where_in(); 生成一段 WHERE field IN (‘item’, ‘item’) 查询语句,如果合适的话,用 AND 连接起来。 $names = array(‘Frank’, ‘Todd’, ‘James’); $this->db->where_in(‘username’, $names); 4)$this->db->or_where_in(); 生成一段 WHERE field IN (‘item’, ‘item’) 查询语句,如果合适的话,用 OR 连接起来。 $names = array(‘Frank’, ‘Todd’, ‘James’); $this->db->or_where_in(‘username’, $names); 5)$this->db->where_not_in(); 生成一段 WHERE field NOT IN (‘item’, ‘item’) 查询语句,如果合适的话,用 AND 连接起来。 $names = array(‘Frank’, ‘Todd’, ‘James’); $this->db->where_not_in(‘username’, $names); 6)$this->db->or_where_not_in(); 生成一段 WHERE field NOT IN (‘item’, ‘item’) 查询语句,如果合适的话,用 OR 连接起来。 $names = array(‘Frank’, ‘Todd’, ‘James’); $this->db->or_where_not_in(‘username’, $names);
|
|
|
发帖时间:2016-10-26 |
查看数:0 |
回复数:0
|