Welcome Guest, Not a member yet? Register   Sign In
Help pagination error
#1

[eluser]zacksyah[/eluser]
Why if I click page two and so on, the pagination error and the message
Code:
404 Page Not Found

The page you requested was not found.
This my code
Code:
<?php
class Buku extends CI_Controller {
    function __construct()
        {
            parent::__construct();
            $this->load->database();
            $this->load->helper(');
            $this->load->model(');
            $this->load->library('pagination'); //call pagination library
        }
    function getBuku() {
        //count the total rows of tb_book
        $this->db->select('*');
        $this->db->from('tb_book');
        $getData = $this->db->get('');
        $a = $getData->num_rows();
        $config['] = base_().'index.php/Buku/getBuku/'; //set the base url for pagination
        $config['total_rows'] = $a; //total rows
        $config['per_page'] = '2'; //the number of per page for pagination
        $config['] = 3; //see from base_. 3 for this case
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $this->pagination->initialize($config); //initialize pagination
        $data['title'] = 'menampilkan isi buku';
        $data['detail'] = $this->buku_model->getBuku($config['per_page'],$this->uri->segment(3));
        $this->load->view('buku_view', $data);
    }
}
?&gt;
Model
Code:
&lt;?php
        class Buku_model extends CI_Model {
           function __construct()
            {
                parent::__construct();    
            }
            function getBuku($perPage,$uri) { //to get all data in tb_book
                $this->db->select('*');
                $this->db->from('tb_book');
                $this->db->order_by('id','DESC');
                $getData = $this->db->get('', $perPage, $uri);
                if($getData->num_rows() > 0)
                    return $getData->result_array();
                else
                    return null;
            }
}
?&gt;
view
Code:
<h4>Book Data</h4>
&lt;?php if(count($detail) > 0) { ?&gt;
<table border="1">
<tr>
<th>ID</th>
<th>Title</th>
<th>Author</th>
</tr>
&lt;?php
foreach($detail as $rows) {
echo "<tr>";
echo "
<td>". $rows['id']."</td>
<td>". $rows['title'] ."</td>
<td>". $rows['author'] ."</td>
"; } ?&gt;
</table>
&lt;?php } ?&gt;
<div> &lt;?php echo $this->pagination->create_links(); ?&gt; </div>
please help me thanks b4




Theme © iAndrew 2016 - Forum software by © MyBB