|
本帖最后由 sswowo 于 2011-7-23 02:49 编辑
控制器方法
function index()
{
$cur_num = $this->uri->segment(3,0);
$cp['base_url'] = site_url('users_mange/index/');
$cp['total_rows'] = $this->model->get_usercount();
$cp['per_page'] = 10;
//print_r($cp);
$this->pagination->initialize($cp);
$data['userlist'] = $this->model->get_userlist($cp['per_page'], $cur_num );
$data['pagehtml'] = $this->pagination->create_links();
$this->load->view('users_mange', $data);
}
模型方法
function get_userlist($per_page, $cur_num)
{
$query = $this->db->query("SELECT `id`, `username` , `lock` FROM `users` ORDER BY `id` ASC LIMIT ". $per_page * $cur_num .",$per_page");
return $query->result();
}
function get_usercount()
{
return $this->db->count_all('users');
}
有错么?
|
|