how to get data in descending order when using pagination(using
codeigniter )?
i have use codeigniter library function for pagination. it works but i
didn't get how to display the content in descending order.
public function news($offset=0)
{
$this->load->library('pagination');
$config['base_url'] = base_url()."index.php/homepage/inbox_news";
$config['total_rows']=$this->db->count_all_results('news');;
$config['per_page'] = 3;
$config['full_tag_open']='<div class="pagination">';
$config['full_tag_close']='</div>';
$this->pagination->initialize($config);
$data['posts'] = $this->db->limit(3,$offset)->get('news')->result();
$this->load->view('inbox_news',$data);
}
//here news is my table name in database
in the view page, i have done like this
<?php
foreach ($posts as $row)
{
echo $news=$row->news;
}
echo $this->pagination->create_links();
?>`
//it is working but the data is in ascending order by default. what can i
do to put it in ascending order?
No comments:
Post a Comment