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

[eluser]sampada[/eluser]
Hi

I am just trying to use pagination library of codeignitor. I set up following code in controller

<?php
require_once('basecontroller.php');
class Productlist extends BaseController
{
function Productlist()
{
parent::BaseController();

}


function index()
{
$this->display();

}

function display()
{


$this->load->database();
$query=$this->db->query("Select * from coffee");

$this->load->library('pagination');
$config['base_url'] = 'LINK FOR PAGE TO BE PAGINATED';
$config['total_rows'] = '$query->num_rows()';
$config['per_page'] = '1';


$this->pagination->initialize($config);
$data['link']= $this->pagination->create_links();
$this->_render("rapyd/testview",$data);
}

}

?>


The links are displayed as 1 2 3, In first page it shows 3 rows and same for other pages also. I have got only 3 rows in coffee table. I need to show 2 rows on first page and thrd row in second page.

Can you help me on it? I have not used CI so much. So I got confused.

Thanks


Messages In This Thread
Pagination not working - by El Forum - 08-21-2008, 01:26 AM
Pagination not working - by El Forum - 08-21-2008, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB