Welcome Guest, Not a member yet? Register   Sign In
$this->db->where
#1

How do I do a $this->db->where for a field where I want it to set to  a or b or c? Do I need three seperate where staements for the same field?

Thanks
Reply
#2

That depend on the type of the condition.
is this either: WHERE id=a OR id=b OR id=c
or: where id=a AND id=b AND id=c
or: where id IN (a,b,c)

Have a look at the tutorial:
https://www.codeigniter.com/userguide2/d...tml#select
look at or_where, where_in, etc depending on what you try to do
On the package it said needs Windows 7 or better. So I installed Linux.
Reply
#3

(05-25-2017, 08:24 AM)rtenny Wrote: That depend on the type of the condition.
is this either: WHERE id=a OR id=b OR id=c
or: where id=a AND id=b AND id=c
or: where id IN (a,b,c)

Have a look at the tutorial:
https://www.codeigniter.com/userguide2/d...tml#select
look at or_where, where_in, etc depending on what you try to do

WHERE id=a OR id=b OR id=c is what I meant


Thanks
Reply
#4

(05-25-2017, 08:33 AM)Knutsford Wrote: WHERE id=a OR id=b OR id=c is what I meant


Thanks


the I would use this

Code:
$names = array('a', 'b', 'c');
$this->db->where_in('username', $names);
On the package it said needs Windows 7 or better. So I installed Linux.
Reply
#5

$this->db->where_in worked - thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB