[SOLVED]first pagination page not clickable

#1
[eluser]bobbob[/eluser]
I have seen another post with this issue yet there wasn't a solution.
Basically the first link doesn't work.
All the others do perfectly.
Also there is no <first appearing.
Only get 1234> Last
The 1 can never be clicked from any of the pages
Any clues??

Controller:

Code:
function search()
     {
        $this->load->helper('security');
        if(isset($_POST['search'])) {
            $keyword = xss_clean($_POST['search']);
            $this->session->set_userdata('search',$keyword);
            }else{
                $keyword = $this->session->userdata('search');
            }
        $this->load->library('pagination');
        $query = $this->db->select('article_id, headline, body');
        $query = $this->db->where('MATCH (BODY,HEADLINE) AGAINST ("'. $keyword .'")', NULL, FALSE);
        
        $query = $this->db->get('articles');
        $config['base_url'] = site_url()."/articles/search/$keyword/";
        $config['total_rows'] = $query->num_rows();
        $config['per_page'] = 10; //20 will be the actual number but for demo less
        
        
        

        $this->pagination->initialize($config);
        $query = $this->db->select('article_id, headline, body');
        $query = $this->db->where('MATCH (BODY,HEADLINE) AGAINST ("'. $keyword .'")', NULL, FALSE);
        $query = $this->db->get('articles',$config['per_page'],$this->uri->segment(4));
        
        $data['query'] = $query;
        $this->load->view('articles/search_results',$data);

        
        
     }

Help much appreciated

#2
[eluser]bobbob[/eluser]
The fix for this is to use the $config

$config['uri_segment'] = 4;

instead of putting
$query = $this->db->get('articles',$config['per_page'],$this->uri->segment(4));
in the query.
put:
$query = $this->db->get('articles',$config['per_page'],$config['uri_segment']);

That had me for a while.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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