Home » Php » mysql – An uncaught Exception was encountered php codeigniter

mysql – An uncaught Exception was encountered php codeigniter

Posted by: admin February 25, 2020 Leave a comment

Questions:
  1. I want to array value push another single array value, how the single data push another array.
  2. This my below code:
$this->db->select('emp_info.empid');
$this->db->from('emp_info');
$this->db->where("emp_info.empid", 2);
$this->db->where("emp_info.comcod", $compcod);
$this->db->where("emp_info.status", 1);
$empdata = $this->db->get();
$data_day = array();
$Dated1 = $this->model_employes->getDatesFromRange($fdate, $tdate);
foreach ($empdata->result() as $emp) {
    foreach ($Dated1 as $key => $day) {
        $dayid = date("Ymd", strtotime($day));
        $data_day[] =
            array(
                'empid' => $emp->empid,
                'shortcode' => '',
                'attdate' => $day,
                'dayid' => $dayid
            );
    }
}
$m_dayid = array();
foreach ($data_day() as $monthday) {
    array_push($data_day, $monthday->dayid);
}
echo "<pre>";
print_r($m_dayid());
echo "</pre>"; 
How to&Answers:

Change the code as follows Instead of $data_day() into $data_day and $m_dayid() into $m_dayid

<?php 
  $m_dayid = array();
  foreach ($data_day as $monthday) {
    array_push($data_day, $monthday->dayid);
  }
 echo "<pre>";
 print_r($m_dayid);
 echo "</pre>"; 

?>