I don't know what i'm doing wrong here, can somebody please help, here's my controller.. I just want to display the database result according to the pagination set.
function post_paginates($offset = 0){
$this->load->model('Users_model');
$this->load->library('pagination');
$limit = 3;
$config['base_url'] = 'http://localhost/blog_ext/index.php/welcome/post_paginates/';
$config['total_rows'] = $this->Users_model->totalcountPost();
$config['per_page'] = $limit;
$config['num_links'] = 2;
$config['uri_segment'] = 4;
$config['page_query_string']=true;
$config['query_string_segment'] = 'pageno';
$this->pagination->initialize($config);
$data['offset'] = $offset;
$posts = $this->Users_model->get_post($limit, $offset);
$data = array(
'posts' => $posts,
'pages' => $this->pagination->create_links()
);
$this->load->view('post_paginates', $data);
}
and here's my model
function get_post($limit, $offset){
$query = $this->db->get('NEWS', $limit, $offset);
return $query->result();
}
and here's the view
<div id="posts">
<?php
if(isset($posts)){
foreach ($posts as $titles) {
echo $titles->HEADLINE;
echo "<br>";
}
}
?>
</div>
<div id="pages">
<?php echo $pages;?>
</div>
thanks in advance.. :-)