Welcome Guest, Not a member yet? Register   Sign In
selective paging.
#1

[eluser]Unknown[/eluser]
Hi,
I'm doing paging but i get all fields from database table. i want to show only selective record not all... can anyone know how to show up?




This is my Controller Code:

**********************************************************
$config['base_url'] = base_url().'index.php/mc/pages/';
$config['total_rows'] = $this->db->count_all('tbl_pages');
$config['per_page'] = '5';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';

$this->pagination->initialize($config);
$data['results'] = $this->mirimodel->getTableEntries("tbl_pages", $config['per_page'], $this->uri->segment(3));
$this->table->set_heading('ID', 'Title', 'ParentPage', 'Sort Order');
$this->load->view('pages', $data);
***********************************************************





This is my View Code:
***********************************************************
&lt;?php echo $this->table->generate($results); ?&gt;
&lt;?php echo $this->pagination->create_links(); ?&gt;
***********************************************************





This is my Model Code:
************************************************************
function getTableEntries($TableName, $Limit = 1000, $offset = 0)
{
$query = $this->db->get($TableName, $Limit, $offset);
return $query->result_array();
}
************************************************************





This is my output
***************************************************************
ID Title ParentPage Sort Order
1 0 Home 0 02/01/2012 0
2 0 About Us 1 02/01/2012 0
3 0 Contact Us 4 02/01/2012 0
4 2 About Us Sub 5 02/01/2012 0
14 1 Home-sub 0 02/01/2012 0

1 2 3 >
***************************************************************




Do i need to change in some query?? or i need to generate some customize table??
Please guide
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB