Codeigniter active record where array Codeigniter active record where array codeigniter codeigniter

Codeigniter active record where array


This might be what you want:

Associative array method:
$array = array('name' => $name, 'title' => $title, 'status' => $status);

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

// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'

You can include your own operators using this method as well:
$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);

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

Source:
http://ellislab.com/codeigniter/user-guide/database/active_record.html


http://ellislab.com/codeigniter/user-guide/database/active_record.html

$whereQuery['service.service_end_date >'] = $start;$whereQuery['service.service_end_date <'] = $start;

You can pass > < <> in CI where function

$this->db->where('field_name <', "Condition_value"); 


From Codeigniter page :

You can include an operator in the first parameter in order to control the comparison:

$this->db->where('name !=', $name);$this->db->where('id <', $id);// Produces: WHERE name != 'Joe' AND id < 45