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
Codeigniter 编码点火器分页_Codeigniter_Activerecord - Fatal编程技术网

Codeigniter 编码点火器分页

Codeigniter 编码点火器分页,codeigniter,activerecord,Codeigniter,Activerecord,我使用的是CodeIgniter分页类,一切正常,但我只想向用户显示数据库中的几个表。目前我正在使用此代码: function index() { $this->load->library('pagination'); $this->load->library('table'); $this->table->set_heading('Id', 'The Title', 'Th

我使用的是CodeIgniter分页类,一切正常,但我只想向用户显示数据库中的几个表。目前我正在使用此代码:

function index() {      
            $this->load->library('pagination');
            $this->load->library('table');

            $this->table->set_heading('Id', 'The Title', 'The Content');

            $config['base_url'] = 'http://localhost/ci_helpbg/';
            $config['total_rows'] = $this->db->get('helps')->num_rows();
            $config['per_page'] = 5;
            $config['num_links'] = 20;
            $config['full_tag_open'] = '<div id="pagination">';
            $config['full_tag_close'] = '</div>';



            $this->pagination->initialize($config);

            $data['records'] = $this->db->get('helps', $config['per_page'], $this->uri->segment(3));




        $data['main_content'] = 'index_view';
        $this->load->view('includes/template', $data);
    }
函数索引(){
$this->load->library('pagination');
$this->load->library('table');
$this->table->set_heading('Id','Title','Content');
$config['base_url']='http://localhost/ci_helpbg/';
$config['total_rows']=$this->db->get('help')->num_rows();
$config['per_page']=5;
$config['num_links']=20;
$config['full_tag_open']='';
$config['full_tag_close']='';
$this->pagination->initialize($config);
$data['records']=$this->db->get('help',$config['per_page'],$this->uri->segment(3));
$data['main_content']='index_view';
$this->load->view('includes/template',$data);
}
我使用此代码在视图中显示分页:

<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>

我只想向用户显示“short_description”、“description”、“photo_thumb”和“date”表字段

谢谢。

选择特定字段 比如说

$this->db->select('t1.name, t1.fname,t1.phone,t1.email');

并为用户创建角色,您将向他们显示哪个部分。

只需为分页创建唯一的select语句即可。比如:

$this->db->select('*');
$this->db->from('table1, table2, table3'); //if you don't want to use table4 or table5 just do not mention that in the statement.
在此之后,将其添加到分页所在的控制器

$data['gettables'] = $this->yourmodel_gettables(); //the model with your select statement

希望有帮助。

仅在分页页上还是在多页上?请提供更多信息。我想在我的索引视图页面上显示这些表字段,而不是全部内容(id…..等)