Situation/Problem
I'm pulling all records form a table. I'm passing the returned data to my view. Num_rows says 5 but the result set is empty although there are records in the table.
controller
public function index()
{
$this->load->model('Accessmodel', 'access');
$data['query'] = $this->access->get_access_roles();
$this->load->view('common/header');
$this->load->view('admin/access/index', $data);
$this->load->view('common/footer');
}
model
class Accessmodel extends Cruddy {
function __construct()
{
parent::__construct();
self::$table = "EmployeeRoleAccess";
}
function get_access_roles()
{
return $this->db->get(self::$table);
}
}
Relevant portion of cruddy
class Cruddy extends CI_Model {
protected static $table;
function __construct()
{
parent::__construct();
}
function get_items()
{
$this->db->from(self::$table);
return $this->db->get();
}
view
<div class="column-left">
<div class="sub-section-left">
<?php include_once APPPATH . 'views/admin/menu.php'; ?>
</div>
<div class="sub-section-left shadows">
<?php include_once APPPATH . 'libraries/minical.php'; ?>
</div>
</div>
<div class="column-right">
<div class="sub-section-right">
<h1>Employee Role Access Templates<input class="create right" type="button" name="" value="New Access Role" onClick=""></h1>
<?php var_dump($query) ?>
</div>
</div>
var_dump of query
object(CI_DB_mysql_result)#19 (8) {
["conn_id"]=>resource(11) of type (mysql link persistent)
["result_id"]=>resource(19) of type (mysql result)
["result_array"]=>array(0) { }
["result_object"]=>array(0) { }
["custom_result_object"]=>array(0) { }
["current_row"]=>int(0)
["num_rows"]=>int(5)
["row_data"]=>NULL
}