Codeigniter管理员用户仪表板问题

Actually, i'm working on Codeigniter admin dashboard users module,i'm trying to show (dashboard) how many users is there from user table from database enter image description here

model file code:

function usercount_total($userId)
{
  $this->db->select('count(1)');
  $this->db->from('tbl_users');
  $query = $this->db->get();
  return $query->result();
}

controller file:

$res['total_users'] = $this->user_model->usercount_total($userId);
$this->loadViews("dashboard", $this->global, $res, NULL);

view file:dashboard.php

<div class="inner">
  <!-- <h3>44</h3> -->
  <h3><?php echo $total_users; ?></h3>
  <p>New User</p>
</div>

Use $this

function usercount_total($userId)
{
 $this->db->select('count(*)');
 $this->db->from('tbl_users');
 $query = $this->db->get();
 return $query->num_rows();
}

You can do it with the help of helpers (an alternative)

Add a file name custom_helper.php in helpers folder and load it with the help of autoload.php like this;

$autoload['helper'] = array('custom');

In custom_helper.php add a method called users_count() like this :

function users_count()
{
     $ci = & get_instance();
     return $ci->db->count_all('tbl_users');         
}

In view do like this :

<div class="inner">
  <h3><?php echo users_count(); ?></h3>
  <p>New User</p>
</div>

For more :https://www.codeigniter.com/user_guide/general/helpers.html