Welcome Guest, Not a member yet? Register   Sign In
Order of precedence Active Record
#1

[eluser]chinedubond[/eluser]
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%');
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.


Messages In This Thread
Order of precedence Active Record - by El Forum - 05-19-2008, 11:57 AM
Order of precedence Active Record - by El Forum - 05-20-2008, 02:55 AM
Order of precedence Active Record - by El Forum - 05-20-2008, 03:08 AM
Order of precedence Active Record - by El Forum - 05-20-2008, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB