[eluser]Chilukuri Bhaskar[/eluser]
Please find my model code and controller code
Model Code
Code:
function news()
{
$q = $this->db->query('select * from `news` order by id DESC');
if($q->num_rows()>0)
{
foreach ($q->result_array() as $row)
{
$data[] = $row;
}
return $data;
}
}
and
Controller Code
Code:
function latestnews()
{
$this->load->model('News_model');
$this->load->library('pagination');
$data['latestNews'] = $this->News_model->news();
$config['base_url'] = 'http://localhost/telugucinemalo/tollywood/latestnews';
$config['total_rows'] = $this->db->get('news')->num_rows();
//$config['total_rows'] = $data['latestNews'];
$config['per_page'] = 10;
$config['num_links'] = 5;
$this->pagination->initialize($config);
$data['latestNews'] = $this->db->get('news', $config['per_page'], $this->uri->segment(3));
$this->load->view('news',$data);
}
please give me solution i need records in descending order
Thanks
Bhaskar