Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter-计算工作台上所有不工作的数据_Php_Codeigniter - Fatal编程技术网

Php Codeigniter-计算工作台上所有不工作的数据

Php Codeigniter-计算工作台上所有不工作的数据,php,codeigniter,Php,Codeigniter,你能帮我做这个吗。我试图计算我的表中有多少,因为它没有在我的视图中显示结果 控制器 public function enrollment_summary() { $data['title'] = 'Enrollment Summary'; $this->load->model('report_model'); $data['query'] = $this->report_model->get_students(); $this-&g

你能帮我做这个吗。我试图计算我的表中有多少,因为它没有在我的视图中显示结果

控制器

  public function enrollment_summary()
  {
    $data['title'] = 'Enrollment Summary';
    $this->load->model('report_model');
    $data['query'] = $this->report_model->get_students();
    $this->load->view('report_enrollment_summary', $data);
  }
型号

 <?php
class report_model extends CI_Model
{
  public function __construct()
  {
    parent::__construct();
    $this->load->database();
  }
  public function get_students()
  {
    $query = $this->db->count_all('students');
  }
}

您的get_students()没有返回任何内容

所以你需要加上一个报税表

您当前的方法

  public function get_students()
  {
    $query = $this->db->count_all('students');
  }
变成

  public function get_students()
  {
    $query = $this->db->count_all('students');
    return $query;
  }

  public function get_students()
  {
    $query = $this->db->count_all('students');
    return $query;
  }
  public function get_students()
  {
    return $this->db->count_all('students');
  }