database active record class group on where clause

#1
[eluser]czetsuya[/eluser]
Hi,

I am using the active record class from codeigniter and it works fine, for example:

Code:
$this->db->where('name', $name);
$this->db->where('title', $title);
$this->db->where('status', $status);

//produces
// WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
{codeigniter docs}

Question: is it possible to produce a grouping in WHERE?
For example:
Code:
WHERE name = 'Joe' OR (title = 'boss' AND status = 'active')

Note the parenthesis tag ( ), and the OR and AND.

Regards,
czetsuya

EDIT:

Nevermind, I've just used the custom string:

Code:
# Custom string:

You can write your own clauses manually:
$where = "name='Joe' AND status='boss' OR status='active'";

$this->db->where($where);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.