codeigniter中的分页错误

时间:2014-05-21 13:46:38

标签: php codeigniter pagination

当我想搜索月份时,我在codeigniter中有错误" 4月"和一年" 2014"在分页第2页回到月份" mei"

这是控制器

function index($nama='', $bln = 0, $thn = 0)
    {
        if (!$nama AND $this->input->post('nama')) 
        {
            $nama = $this->input->post('nama');
        }   
        else if(!$nama)
        {
            $nama = 0;
        }

        if (!$bln AND $this->input->post('bulan')) 
        {
            $bln = $this->input->post('bulan');
        }   
        else if(!$bln)
        {
            $bln = 0;
        }

        if (!$thn AND $this->input->post('tahun')) 
        {
            $thn = $this->input->post('tahun');
        }   
        else if(!$thn)
        {
            $thn = 0;
        }

        $count = $this->miuran->get_count_iuran($nama, $bln, $thn);

        // Set up pagination
        $offset = 0;
        $perpage = 5;
        $uri_segment = 7;
        if ($count > $perpage) {
            $this->load->library('pagination');
            $this->load->config('pagination');

            $config = $this->config->item('pag');

            $config['base_url'] = site_url('pelatih/iuran/'.$nama.'/'.$bln.'/'.$thn);
            $config['total_rows'] = $count;
            $config['per_page'] = $perpage;
            $config['uri_segment'] = $uri_segment;
            $this->pagination->initialize($config);
            $this->data['pagination'] = $this->pagination->create_links();
            if($this->uri->segment($uri_segment)){
                $offset = $this->uri->segment($uri_segment);
            }
        }
        else 
        {
            $this->data['pagination'] = '';
            $offset = 0;
        }

        $this->data['anggota'] = $this->miuran->get_daftar_iuran($bln, $thn,$nama,$perpage,$offset);

        $this->data['title'] ='UKM Taekwondo | iuran';
        $this->data['orang'] = $this->mlogin->dataPengguna($this->session->userdata('username'));
        $this->data['contents'] = $this->load->view('pelatih/iuran/view_iuran', $this->data, true);
        $this->load->view('template/wrapper/pelatih/wrapper_anggota',$this->data);
    }

当我将第2页数据切换回月份时," mei"。

请帮我做什么。

谢谢。

1 个答案:

答案 0 :(得分:0)