Kohana 3.0 ORM WHERE - AND
i want to make a corelated query using KO3 ORM, meaning that i want to have two conditions in an where:
now i have:
public function get_free(){
return $this->where('s开发者_JS百科tatic_members_only','=',self::FREE);
}
and i would like to have:
public function get_free(){
return $this->where('static_members_only','=',self::FREE) AND (some other conditions)
}
is it possible?
thank you!
and_where()
is just a proxy to where()
, so there is no difference whichever you choose to use. So
ORM::factory('model')
->where('something','=',$something)
->where('something_else','LIKE',$something_else)
->find_all();
will produce something like:
SELECT models.*
FROM models
WHERE something = '$something'
AND something_else LIKE '$something_else'
Of course, all vars will be escaped / prepared so you don't have to worry about sql injection.
can you try : Kohana's where_open() and where_close() methods ? I think it should be done that way.
精彩评论