用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2376|回复: 6
收起左侧

[HELP] 新手求助 关于分页问题

[复制链接]
发表于 2010-12-2 14:32:22 | 显示全部楼层 |阅读模式
简单的小例子 帮看看 哪里出了问题 惆怅了。。。
这个是INDEX函数里的
                     $this->load->library('pagination');
                $config['base_url'] = site_url('create/index');
                $config['total_rows'] = $this->db->count_all('password');
                $config['per_page'] = 5;
                 
                $config['full_tag_open'] = '<p>';
                $config['full_tag_close'] = '</p>';
                $this->pagination->initialize($config);
                 $this->load->library('table');
                $this->load->model('display');//数据库查询
                 
                $data['results'] = $this->display->select_except_password();
                $this->load->view('create_page',$data);

下面是页面create_page
<?php echo $this->table->generate($results); ?>
<?php echo $this->pagination->create_links(); ?>


问题是:PER_PAGE貌似没有设置上 每页还是现实好多 按理来说不应该是5个么
发表于 2010-12-2 14:46:35 | 显示全部楼层
不清楚,帮顶。。。
发表于 2010-12-2 15:02:05 | 显示全部楼层
你读数据的时候有没有limit啊,分页类不能帮你完成查询数据的操作
 楼主| 发表于 2010-12-2 15:05:15 | 显示全部楼层
回复 3# jeongee


    我不太明白你的意思 你的意思是 数据库查询结果必须只有5个数据?然后点击下一页的时候 再执行新的表单用新的数据库查询 是么?
发表于 2010-12-2 15:11:41 | 显示全部楼层
分页类只是帮助我们生成分页样式
但数据具体该显示哪几条 需要我们自己做处理
具体可以看下手册
http://codeigniter.org.cn/user_guide/libraries/pagination.html
你会发现分页类没有对结果集做任何处理
发表于 2010-12-2 15:15:43 | 显示全部楼层
回复 4# hangyi03

呵呵,你需要了解一下分页原理,去百度、谷歌搜搜吧
发表于 2010-12-2 22:07:23 | 显示全部楼层
分页类没有查询操作的说

本版积分规则