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?
Found the answer.
It's done with Kohana's where_open() and where_close() methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With