• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination Trouble

#1
[eluser]anyamanggar[/eluser]
Hi Guys,
i have problem with pagination, i dont know what i have todo cuz i am nubie. The problem is if i click number 2 the data still not change.

here my controller

Code:
public function headline(){
$this->check_logged_in();
$this->load->library('table');
$this->load->helper('html');
$this->load->model('headline_model');
$this->load->library('pagination');
$data['query'] = $this->headline_model->getall();
$config['base_url'] = base_url().'login/headline/';
$config['total_rows'] = 200;
$config['per_page'] = 20;
$this->pagination->initialize($config);
$this->load->view('backend/headline_view', $data);
}

heres my model

Code:
class Headline_model extends CI_model{

function __construct()
{
  parent::__construct();
}

// ini untuk mengambil //
function getall(){
$this->load->database();
$query = $this->db->get('headline');
return $query->result();
}

function findById($id) {
        $this->db->where('id', $id);
       $query = $this->db->get('headline');
        return $query->row_array();
    }

function update(){
$this->load->database();
$data = array(
'title'=>$this->input->post('title'),
'content'=>$this->input->post('content'),);
$this->db->where('id',$this->input->post('id'));
$this->db->update('halaman',$data);
}

}

view
Code:
<table class="tableberita" width="800" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td width="28" align="center" valign="middle"><strong>ID</strong></td>
    <td width="583" align="center" valign="middle"><strong>Title Content</strong></td>
    <td width="167" align="center" valign="middle"><strong>Keterangan</strong></td>
  </tr>
  &lt;?php $i = 1 ?&gt;
  &lt;?php foreach ($query as $row):  ?&gt;
  <tr>
    <td align="center" valign="middle">&lt;?php echo $i++ ?&gt;</td>
    <td align="left" valign="middle">&lt;?php echo $row->title ?&gt;</td>
    <td align="center" valign="middle">| &lt;?php echo anchor('login/editheadline/'.$row->id,'Edit');?&gt; |</td>
  </tr>
&lt;?php endforeach; ?&gt;
</table>
&lt;?php echo $this->pagination->create_links(); ?&gt;

please help me.. Sad

#2
[eluser]anyamanggar[/eluser]
please help me guys, i am nubie

#3
[eluser]Aken[/eluser]
You need to specify the uri_segment config option of your pagination.

#4
[eluser]anyamanggar[/eluser]
[quote author="Aken" date="1342582723"]You need to specify the uri_segment config option of your pagination.[/quote]

thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.