05-19-2008, 11:57 AM
[eluser]chinedubond[/eluser]
I HAVE THIS PROBLEM
The problem is the query searches city and companyname if true then searches keywords
i don't want that.What i want is a situation where i can get the active record to produce this result.
This way the result of keywords and companyname is produced first before compared with city.
Please how can achieve this with active record.
Thank you.
I HAVE THIS PROBLEM
Code:
$this->db->like('companyname',$keyword);
$this->db->or_like('keywords',$keyword);
$this->db->where('city',$city);
$this->db->orderby('companyname');
$this->db->get('ng_city');
it produces select * from ng_city where city='somecity' and companyname like '%somecompany%' or keywords like '%somekeyword%';
The problem is the query searches city and companyname if true then searches keywords
i don't want that.What i want is a situation where i can get the active record to produce this result.
Code:
select * from ng_city where city='somecity' and ( companyname like '%somecompany%' or keywords like '%somekeyword%');
Please how can achieve this with active record.
Thank you.