|
本帖最后由 飞雪残剑 于 2010-2-9 23:04 编辑
我仿照“一哈子”的视频做分页可总有个错,急死我了都
错误提示:
这是我控制器里的代码
$this->load->view('comment_view',$data);
$config['base_url']=base_url().'index.php/blog/comments/'.$this->uri->segment(3);
$config['total_rows']=$this->Mblog->select_num_rows($this->uri->segment(3));
$config['per_page']=5;
$config['uri_segment']=4;
$config['full_tag_open']='<p>';
$config['full_tag_close']='</p>';
$config['first_link']='第一页';
$config['last_link']='尾页';
$config['next_link']='下一页';
$config['prev_link']='上一页';
$this->pagination->initialize($config);
$data['comments_list']=$this->Mblog->get_page($this->uri->segment(3),$this->uri->segment(4,0),$config['per_page']);
$this->load->view('comment_view',$data);
这是我模型里的代码
function select_num_rows($category)
{
$query = $this->db->query("SELECT * FROM comments WHERE entry_id = $category");
return $query->num_rows();
}
其中控制器里第三行就是错误提示的“line 45” |
|