public function get_tertiarylevel_present() {
$checker = array(
'timestamp' => strtotime(date('Y-m-d')),
'section_id' => 11,
'status' => 1
);
$tertiarylevel_present = $this->db->get_where('daily_attendances', $checker);
return $tertiarylevel_present->num_rows();
}
Currently it is checking for 'status' value 1(Present only).How to modify that also checks if the database have 'status' value 3(Late). how to include in the array if there is more than one value to check.
CodePudding user response:
You need to use where_in
( https://www.codeigniter.com/userguide3/database/query_builder.html#CI_DB_query_builder::where_in ):
This should work (haven't tested it though):
public function get_tertiarylevel_present() {
$this->db->where('timestamp', strtotime(date('Y-m-d')));
$this->db->where('section_id', 11);
$this->db->where_in('status', array(1, 3));
$tertiarylevel_present = $this->db->get('daily_attendances');
return $tertiarylevel_present->num_rows();
}
CodePudding user response:
change where condition array to this :
<pre> <code>
$array = array( 'timestamp' => strtotime(date('Y-m-d')),
'section_id' => 11,
'id >=' => 1
);
</code> </pre>
you should use 'id >' => 1 to tell orm what condition do you mean