[eluser]penta997[/eluser]
Hello. I have a problem with search. When the result are apear is ok, but when I click on the next link, the number of links grows.
this i my pagination code:
Code:
function get_books_by_keyword()
{
$widok['left'] = $this->get_category();
$widok['right'] = $this->get_bestseller();
$widok['zakupy'] = $this->sum_all();
$widok['licznik'] = $this->counter();
$widok['tytul'] = 'Wyszukiwanie';
$widok['center'] ='';
$config['base_url'] = 'http://lukaszbielecki.cba.pl/ksiegarnia/CI/index.php/site/get_books_by_keyword/';
$this->db->like('BOOK_Title', $this->input->post('szukaj'));
$config['total_rows'] = $this->db->get('books')->num_rows();
$config['per_page'] = 7;
$config['num_links'] = 10;
$query = $this->Kategorie_model->get_books_by_keyword();
$this->pagination->initialize($config);
$config['per_page'] = 7;
$config['uri_segment'] = 3;
if($query->num_rows() > 0)
{
foreach($query->result() as $data)
{
$widok['center'] .= $this->load->view('Ksiegarnia/book_searching',array('data' =>$data), true);
}
}
else
{
echo 'no data';
}
$widok['center'] .= '<div class="pagination">'.$this->pagination->create_links().'</div>';
$this->load->view('Ksiegarnia/index_logged', $widok);
}
model:
Code:
function get_books_by_keyword()
{
$key = $this->input->post('szukaj');
//echo $key;
$query = $this->db->query("select * from books where BOOK_Title like '%".$key."%' LIMIT 7,7");
return $query;
}