THIS IS MY MODEL:
public function GetAttendance($from, $to)
{
$sql = "SELECT a.empnum,CONCAT(a.name,' ',a.midname,' ',a.lastname) AS
NAME,CONCAT(b.indate,' ',b.intime) AS 'TIMEIN',CONCAT(b.outdate,'
',b.outtime)AS 'TIMEOUT', DATEDIFF('timeout','timein') AS 'DUR'
FROM employees AS a
JOIN times AS b ON (a.empnum=b.userid)
WHERE b.indate BETWEEN
STR_TO_DATE('".$from."','%m/%d/%y') AND STR_TO_DATE('".$to."','%m/%d/%y')";
$query = $this->db->query($sql);
return $query->result();
}
}
My Controller:
public function goEmployee()
{
$username = $this->session->userdata('username');
$this->load->model('Model_attendance');
$query = $this->Model_attendance->getOne($username);
$data['EMPLOYEES'] = null;
$data['isAdmin'] = false; //that will check if the user is admin or not
if ($query) {
$data['EMPLOYEES'] = $query;
}
$this->load->view('imports/header');
$this->load->view('imports/menu');
$this->load->view('employee', $data);
}
An error message pops up when I filter the dates from two different days with this on it
[{"empnum":"2","NAME":"Jon B. Pueblo","TIMEIN":"2016-01-22 16:06:08","TIMEOUT":"2016-01-24\r\n 15:13:13","DUR":null}, {"empnum":"2","NAME":"Jon B. Pueblo","TIMEIN":"2016-01-25 21:07:43","TIMEOUT":"2016-01-25\r\n 21:13:22","DUR":null}
AND this is my view
Ive made it into an image since stack overflow wont allow me to post it VIEW