Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Pagination - all records on all pages
#1

[eluser]predat0r[/eluser]
Hi, first of all I made several good working paginations earlier. This time has no idea what is wrong. The point is, I have the pagination routin startad, page numbers appear, but I have all records from a table on all pages. So 8 records on first page, the same 8 records on second page and so on.

Any idea? thx

The controller:
Code:
function programok() {
            
        $config['base_url'] = 'http://localhost/site/admin/programok';
        $config['total_rows'] = $this->db->get('programok')->num_rows();
        $config['per_page'] = 5;
        $config['num_links'] = 20;
    
        $this->pagination->initialize($config);
            
            $this->db->order_by('datum', 'DESC');
            $q = $this->db->get('programok');
            if($q->num_rows() > 0) {
                $data['records'] = $q->result();    
            }            
            $data['tartalom'] = 'ad_programok_ossz';
            $this->load->view('admin', $data);
        }
The view that loaded and need pagination
Code:
<table>
...
&lt;?php foreach ($records as $record)
        {
            echo '<tr>';
            echo '<td>' . $record->id . '</td>';
            echo '<td>' . $record->program . '</td>';
            echo '<td>' . $record->datum . '</td>';
            echo '<td align="center">' . anchor('admin/prog_szerk/'.$record->id, img(array('src' => 'images/szerkeszt.png', 'border' => '0'))) . '</td>';
            if($record->publikal == 1)
                {            
                    $chkparams = array(
                        'class' => 'chkbox',
                        'checked' => TRUE,
                        'name' => 'publchk',
                        'value' => $record->id
                    );
                    echo '<td align="center">' . form_checkbox($chkparams) . '</td>';
                } else {
                    echo '<td align="center">' . form_checkbox($chkparams) . '</td>';    
                    $chkparams = array(
                        'class' => 'chkbox',
                        'checked' => FALSE,
                        'name' => 'publchk',
                        'value' => $record->id
                    );
                }                
            echo '<td align="center">' . anchor('admin/prog_torol/'.$record->id, img(array('src' => 'images/torles.png', 'border' => '0')), array('onclick' => 'return(confirm(\'Biztosan törlöd?\'));')) . '</td>';
            echo '</tr>';
        }
?&gt;
</table>
<div align="center">&lt;?php echo $this->pagination->create_links(); ?&gt;</div>
#2

[eluser]Deveron[/eluser]
Hi,

i think your forgot to put this active record line in your controller:

Code:
$this->db->limit(5, $this->uri->segment(3));
#3

[eluser]predat0r[/eluser]
[quote author="deveron" date="1289936625"]Hi,

i think your forgot to put this active record line in your controller:

Code:
$this->db->limit(5, $this->uri->segment(3));
[/quote]

thanks deveron, that was the problem :-P




Theme © iAndrew 2016 - Forum software by © MyBB