views:

116

answers:

1

I'm trying to run a query through the ORM like this:

   SELECT * from table where (fname like 'string%' or lname like 'string%') 
AND (fname like 'string2%' or lname like 'string2%');

Here's what i have so far:

$results = ORM::factory('profiles');
foreach ($strings as $string) {
    $result->where('fname', 'like', "$string%");
    $result->or_where('lname', 'like', "$string%");
}

But this doesn't account for the parentheses. Any ideas?

+1  A: 

Found the answer.

It's done with Kohana's where_open() and where_close() methods.

DexterW