[eluser]Computerzworld[/eluser]
Hello,
I am having one query in which there is one or condition & one and condition. Here is the format of my query.
Code:
$this->db->where('field1',$this->field1);
$this->db->or_where('field2',$this->field2);
$this->db->where('field3',$this->field3);
$query = $this->db->get('users');
And if I echo this query it gives result something like this.
Code:
$query = "select * from users where field1 = '".$this->field1."'" or field2 = '".$this->field2."' and field3 = '".$this->field3."'";
And hence it contains no brackets between or conditions , and condition is neglected. Is there anyway so that i can have brackets outside the query in CI format so that or condition is grouped alongwith and condition something like this...
Code:
$query = "select * from users where (field1 = '".$this->field1."'" or field2 = '".$this->field2."') and field3 = '".$this->field3."'";
How can I write such query using CI? Please help me. Thanks in advance....