Nie znam translate codeigniter db tego zapytania sql
select * from table
where a=1 and (b=1 or c=1 or d=1)
$this->db->where $this->db->or_where ?!?!
ktoś mi pomoże? wielkie dzięki Z poważaniem
Odpowiedzi:
3 dla odpowiedzi № 1Myślę, że jest to zapytanie, którego szukasz.
$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 dla odpowiedzi nr 2
Jeśli stroiłeś doc
możesz zobaczyć, że jeśli użyjesz lub_ gdzie zrobisz zapytanie, takie jak
$this->db->where("name !=", $name);
$this->db->or_where("id >", $id);
// Produces: WHERE name != "Joe" OR id > 50
0 dla odpowiedzi № 3
Użyj tego kodu.
$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);