This is my code
$attendanceDetail = $this->common->getWhere('tbl_attendance', 'date', $allDate);
$total = $attendanceDetail->num_rows();
if($total >0 )
{
echo "record found";
}
else{
echo "Not Found";
}
How to get a total number of record in the query result?
Try this: Put this method in your Model
public function count_records($table_name) {
return $this->db->count_all($table_name);
}
count_all
is query builder class method which returns total no of records in a table see here
and inside your controller method use it like this:
$total_records = $this->your_model->count_records('put_table_name_here');
$attendanceDetail = $this->common->getWhere('tbl_attendance', 'date', $allDate);
$total = count($attendanceDetail);
if($total >0 )
{
echo "record found";
}
else{
echo "Not Found";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.