Simple solution to complex where clause brace problen in Code-igniter
In Code-Igniter How do you make a query with where clause with a brace like following —
SELECT * FROM props WHERE `active` = 1 AND (rent >= 25 OR price >=25) AND 1= 1 AND `props`.`id` = '1'
Code-Igniter active record pattern does not generally support this type of query as far i searched.
I found a surprising solution for this type of query. for this query i make the where clause like following —
$this->db->where('(rent >= 25 OR price >=25) AND 1= ',1); $this->db->where('props.id',1);
Which does the tricks.
I don’t actually know this is the fault of the developers or a feature but it is good for my work to move on.
so the total query for this SQL becomes —
$this->db->where('(rent >= 25 OR price >=25) AND 1= ',1); $this->db->where('props.id',1); $this->db->get('props');
cheers………