/ / database codeigniter in cui la soluzione clausola or_where - php, mysql, sql, codeigniter, dove

database codeigniter in cui la soluzione clausola or_where - php, mysql, sql, codeigniter, dove

non conosco il codeigniter db translate di questa query sql

select * from table
where a=1 and (b=1 or c=1 or d=1)

$this->db->where $this->db->or_where ?!?!

qualcuno mi dà un aiuto? molte grazie i migliori saluti

risposte:

3 per risposta № 1

Penso che questa sia la domanda che stai cercando.

$query = $this->db->select("*")
->from("table")
->where("a", 1)
->group_start()
->where("B", 1)
->or_where("c", 1)
->group_end()
->get()
->result_array();

var_dump($query);

0 per risposta № 2

Se tu eri il doc

puoi vedere che se usi o_dove farai una query come

$this->db->where("name !=", $name);
$this->db->or_where("id >", $id);

// Produces: WHERE name != "Joe" OR id > 50

0 per risposta № 3

Usa questo codice.

$this->db->select("*");
$this->db->where("a", 1);
$this->db->or_where("b", 1);
$this->db->or_where("c", 1);
$this->db->or_where("d", 1);