Welcome Guest, Not a member yet? Register   Sign In
Problem with pagination
#1

[eluser]Docmo[/eluser]
Hi,

I'm sorry if my english is not good, it's my 4th language..

I have a problem with the pagination, after generating the results with a search engine.

Here is my code (in the controller)

Code:
if(isset($_POST['categorie']) && isset($_POST['contenu']))
        {
            $tmp=3;
            if($this->uri->segment(4)){
                $query = $this->Model_job->getResult($_POST['categorie'], $_POST['contenu'], $this->uri->segment(4) ,$tmp);
                $query2 = $this->Model_job->getResult($_POST['categorie'], $_POST['contenu'], 0 ,0);
            }
            else
            {
                $query = $this->Model_job->getResult($_POST['categorie'], $_POST['contenu'], '0' , $tmp);
                $query2 = $this->Model_job->getResult($_POST['categorie'], $_POST['contenu'], 0 , 0);
            }
            $search = explode(' ', $_POST['contenu']);
            $req = 'http://www.job24.ca/job/resultats/';
            $req = $req.$search[0];
            for($i=1;$i<count($search);$i++)
            {
                $req=$req."+".$search[$i];
            }
            $config['base_url'] = $req;
            $config['total_rows'] = $this->countRes($query2);
            $config['per_page'] = $tmp;
            
            $this->pagination->initialize($config);
            $data['links']=$this->pagination->create_links();
            $data['res'] = $query;
            $this->load->view('resultats',$data);
        }
        else
        {
            $tmp=3;            
                    
            
            if($this->uri->segment(3)){
                $query = $this->Model_job->getResult('', '', $this->uri->segment(3) , $tmp);
                $query2 = $this->Model_job->getResult('', '', 0 , 0);
            }
            else{
                $query = $this->Model_job->getResult('', '', '0' , $tmp);
                $query = $this->Model_job->getResult('', '', 0 , 0);
            }
        
            
            $config['base_url'] = 'http://www.job24.ca/job/resultats';
            $config['total_rows'] = $this->countRes($query2);
            $config['per_page'] = $tmp;

            $this->pagination->initialize($config);
            $data['links']=$this->pagination->create_links();
            $data['res'] = $query;
            $this->load->view('resultats',$data);
            
        }
    }

The code in the "else" works perfectly, and so the pagination. (it's when the user doesn't enter any key words in the search engine)
But in the first if, the code inside is not working. When the user enters 2 key words ("word1 word2" for example) or even 1 key word, the code generates the results with the pagination, but when i click on "2" or "3", i obtain an error, and i don't understain why when i click on "2" the is executed and not the first if.

I hope that you understood my problem, and thank you for helping me!


...


Messages In This Thread
Problem with pagination - by El Forum - 06-25-2009, 02:22 PM
Problem with pagination - by El Forum - 06-25-2009, 02:29 PM
Problem with pagination - by El Forum - 06-25-2009, 03:03 PM
Problem with pagination - by El Forum - 06-25-2009, 04:16 PM
Problem with pagination - by El Forum - 06-25-2009, 04:25 PM
Problem with pagination - by El Forum - 06-26-2009, 04:21 AM
Problem with pagination - by El Forum - 06-26-2009, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB