Hello i'm having problem on passing some data from my Model to my View, with this following code:
Controller:
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->helper('form');
$this->load->helper('url');
}
public function testing(){
$query = $this->Model->getEmployees();
if(isset($query)){
$data['fds'] = $query;
}
$this->load->view('UserPage', $data);
}
}
Model:
class Model extends CI_Model{
function __construct()
{
parent::__construct();
$this->load->library('session');
}
public function getEmployees(){
$this->db->select('*');
$this->db->where("idcliente='".$_SESSION['userid']."'");
$query=$this->db->get('marcacao');
return $query->num_rows() > 0 ? $query->result() : NULL;
}
}
View:
<table class="table table-striped table-bordered">
<tr>
<td><strong>Employee Id</strong></td>
<td><strong>First Name</strong></td>
<td><strong>Last Name</strong></td>
</tr>
<?php foreach($fds as $employee){?>
<tr>
<td><? =$employee->data;?></td>
<td><? =$employee->hora;?></td>
<td><? =$employee->tipo;?></td>
</tr>
<?php }?>
</table>
I've tried several things that I've seen here but none works... Hope you can help me.