Below function i.e getBooksInsertedCount code gives output like this
array(3) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(1) "1"
}
getBooksInsertedCount
function getBooksInsertedCount()
{
$this->load->database();
$query = "SELECT count(book_id) as count,date(created_date) as cdate FROM `bookdetails` WHERE (created_date BETWEEN '2018-06-25' AND '2018-06-28') GROUP by created_date order by created_date asc";
$result = $this->db->query($query);
$ret = array();
foreach ($result->result_array() as $row ) {
$ret[] = $row['count'];
}
return $ret;
}
Expected output(Note here: [0]=> string(1) is removed)
array(1, 2, 1);