[PHP] codeigniter where
4 naročniki
4 naročniki
$this->CI->db->where('groupid',1);
$this->CI->db->where('groupid',2);
$this->CI->db->where('group_id',3);
select * from table where groupid = 1 and groupid = 2 and group_id = 3
....
kakšen je ukaz, da namesto and uporabim OR??
torej:
select * from table where (groupid = 1 or groupid = 2 or group_id = 3)
8 odgovorov
or_where
http://codeigniter.com/userguide/database/activerecord.html
$this->db->where('name !=', $name);
$this->db->or_where('id >', $id);
// Produces: WHERE name != 'Joe' OR id > 50
$this->CI->db->where('groupid',1);
$this->CI->db->orwhere('groupid',2);
$this->CI->db->orwhere('group_id',3);
to ne gre? javi kakšno napako ali izpiše query?
ne, zgenerira napačen query. rešitev je edino...
$this->CI->db->where("(groupid='1' or groupid='2' or group_id='3')");