function get_numer_of_cyte_by_author($link) { $query = $this->db->query("SELECT `tresc` FROM `cytaty` where `artysta` = '$link' and `status` = 1"); return $query->num_rows(); } function getSearchResults($kogo, $perpage, $to) { $query = $this->db->query("select * from `cytaty` where `artysta` = '$kogo' and `status` = 1 limit $to, $perpage"); $lis = $query ->result(); return $lis; }
Kontroler:
function pokaz($kogo) { $this->load->model('cytat'); $this->load->library('pagination'); $tekst['artysci'] = $this->cytat->get_artists(); $tekst['users'] = $this->cytat->get_users(); $config['base_url'] = site_url().'/cytaty/pokaz/'.$kogo.''; $config['total_rows'] = $this->cytat->get_numer_of_cyte_by_author($kogo); $config['per_page'] = '2'; $this->pagination->initialize($config); $tekst['imie'] = $this->cytat->get_artist_name($kogo); //$tekst['dane'] = $this->cytat->get_cyte_by_author($kogo); if(!$this->uri->segment(4)) $lol = 0; else $lol = $this->uri->segment(4); $tekst['dane'] = $this->cytat->getSearchResults($kogo, $config['per_page'], $lol); $this->load->view('pokaz-cytaty', $tekst); }
I widok:
<? foreach($dane as $dana) { } ?> <? ?>
Dostaję owe 2 rekordy.. Oraz paginację. Lecz gdy przejdę do 2 strony, to nadal pogrubiona jest strona 1, i nie mogę wrócić do 1 strony, prócz rzecz jasna wstecz w przeglądarce.. Rekordy podawane są prawidłowo.
Proszę o pomoc

PS. Już działa! Dodałem do configa $config['uri_segment'] = '4'; i działa
