While the solution works, I want to add: be careful! You must protect your request and avoid all values! If you like to use Query Builder
$q = $this->db->select('*')->from('posted_ads') ->where('infor', 'rent') ->or_group_start() ->where('typeq', 'in') ->where('typeq', 'out') ->group_end() ->get();
In this way, Codeigniter takes care of the correct escape.
Michael
source share