Welcome Guest, Not a member yet? Register   Sign In
Pagination Problem
#1

[eluser]weetstraw[/eluser]
When I click the link to view the next set of results, I get a 404 not found...
Code:
//Controller
function index()
{
    // Pagination
    $config['base_url']=base_url()."home/";
    $config['total_rows']=$this->db->count_all('content');
    $config['per_page']=2;
    $this->pagination->initialize($config);
    echo

    // Page Content
    $data=array(
        'result'=>$this->Home_model->getRecentPag($config['per_page'],$this->uri->segment(1)),
        'comments'=>$this->Home_model->getComments(),
        'title'=>"",
        'pagination'=>$this->pagination->create_links()
    );

    $this->load->view('home_view',$data);
}
Code:
// Model
function getRecentPag($num,$offset)
{
    $this->db->order_by('id','DESC');
    $query=$this->db->get('content',$num,$offset);

    return $query->result();
}
Code:
//Link
http://localhost/CodeIgniter/home/2

Any idea??
#2

[eluser]Thorpe Obazee[/eluser]
Code:
http://localhost/CodeIgniter/home/2

shouldn't this be
Code:
http://localhost/CodeIgniter/home/index/2

and
Code:
$config['base_url']=base_url()."home/";

should be

Code:
$config['base_url']=base_url()."home/index/";

Unless you are doing some routing.
#3

[eluser]weetstraw[/eluser]
got it. thanks!
#4

[eluser]Thorpe Obazee[/eluser]
no problem Wink




Theme © iAndrew 2016 - Forum software by © MyBB