DB::select()->from('table')
->where('column1', '=', 'foo')
->where('column2', '=', 'bar')
->execute();
$params = array('column1' => 'foo', 'column2' => 'bar');
$data = $this->my_model->get_data($params);
$params = array('column3' => 'foo', 'column4' => 'bar');
$data = $this->my_model->get_data($params);
$params = array(array('column1', '=', 'foo'), array('column2', '=', 'bar'));
$select = DB::select()->from('table');
foreach ($params as $where)
{
$select->where($where[0], $where[1], $where[2]);
}
$select = $select->execute();
You can use any operator you want. Examples include IN, BETWEEN, >, =<, !=, etc. Use an array for operators that require more than one value.
[...]$query = DB::select()->from('users')->where('username', 'IN', array('john','mark','matt'));
Jelmer Schreuder wrote on 02/09/11 8:40 am:Excerpt from the above manual:You can use any operator you want. Examples include IN, BETWEEN, >, =<, !=, etc. Use an array for operators that require more than one value.
[...]$query = DB::select()->from('users')->where('username', 'IN', array('john','mark','matt'));
It looks like you're new here. If you want to get involved, click one of these buttons!