Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Pagination Problem!
#21

[eluser]husni[/eluser]
ok..i will wait.. :-)
thnx a lot..
#22

[eluser]husni[/eluser]
Code:
http://localhost/helpdesk2/index.php/paging/display/&per_page=5

this is my uri..
looks like something wrong hm??
#23

[eluser]maria clara[/eluser]
[quote author="husni" date="1264681368"]
Code:
http://localhost/helpdesk2/index.php/paging/display/&per_page=5

this is my uri..
looks like something wrong hm??[/quote]

like what's wrong with your uri???
#24

[eluser]husni[/eluser]
the '&' sign after the '/'??
huhu..
i don't know what is th eproblem..so i just guess..
#25

[eluser]maria clara[/eluser]
your uri should be look like this:

Code:
http://localhost/helpdesk2/index.php/paging/display/5

not this:

Code:
http://localhost/helpdesk2/index.php/paging/display/&per_page=5

can you post your updated controller??
#26

[eluser]husni[/eluser]
[quote author="maria clara" date="1264682391"]your uri should be look like this:

Code:
http://localhost/helpdesk2/index.php/paging/display/5

not this:

Code:
http://localhost/helpdesk2/index.php/paging/display/&per_page=5

can you post your updated controller??[/quote]

that's why i said something wrong with my uri..
this is my controller..
Code:
<?php
class Paging extends Controller{

    function Paging(){

        // load controller parent
    
        parent::Controller();
    
        // load 'Users' model
    
        $this->load->model('Helpdesk_model');

    }

    function display($row=0){

        // load pagination library
        
        $this->load->library('pagination');
        
        // set pagination parameters
        
        $config['base_url']='http://localhost/helpdesk2/index.php/paging/display/';
        
        $config['total_rows']=$this->Helpdesk_model->getNumReport();
        
        $config['per_page']='5';
        //$config['uri_segment'] = '3';
        
        $this->pagination->initialize($config);
        
        // to multiply your offset by your $config[‘per_page’]
        //That should get rid of the mysql error if no page is specified too
        if (isset($page) && is_numeric($page))
            {
                  $offset = $page;  //Because if the page is 1 then the offset should be 0
            }
            else
            {
              $offset = 0;
            }
            
        $data['query'] = $this->Helpdesk_model->getAllReport(5,$offset);
        
        // store data for being displayed on view file
        
        $data['reports']=$this->Helpdesk_model->getReport($row);
        
        $data['title']='Displaying Report data';
        
        $data['header']='Report List';
        
        $data['links']=$this->pagination->create_links();
        
        // load 'testview' view
        
        $this->load->view('report_view',$data);

    }

}

?>
#27

[eluser]maria clara[/eluser]
can you try this:

Code:
....

$this->load->model('Helpdesk_model');

$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));

.....

or

Code:
....

$this->load->model('Helpdesk_model');

$data['query'] = $this->Helpdesk_model->getAllReport($config['per_page'],$this->uri->segment(3));

.....
#28

[eluser]husni[/eluser]
[quote author="maria clara" date="1264683182"]can you try this:

Code:
....

$this->load->model('Helpdesk_model');

$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));

.....

or

Code:
....

$this->load->model('Helpdesk_model');

$data['query'] = $this->Helpdesk_model->getAllReport($config['per_page'],$this->uri->segment(3));

.....
[/quote]

where should i put the given code?

got this error
Quote:A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&per_page=5, 5' at line 1

SELECT * FROM tblreport ORDER BY report_id ASC LIMIT &per_page=5, 5

this one also when i put the code after
Quote: $this->load->model('Helpdesk_model');

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined variable: config

Filename: controllers/paging.php

Line Number: 14
#29

[eluser]maria clara[/eluser]
or so, try to put this line
$this->load->model('Helpdesk_model');
$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));
inside your function display($row==0)

or if it still don't work just take out this:
Code:
$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));
#30

[eluser]husni[/eluser]
[quote author="maria clara" date="1264684561"]or so, try to put this line
$this->load->model('Helpdesk_model');
$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));
inside your function display($row==0)

or if it still don't work just take out this:
Code:
$data['query'] = $this->Helpdesk_model->getNumReport($config['per_page'],$this->uri->segment(3));
[/quote]

my uri still the same..
i wonder why my uri can be like that?
do you have any idea?




Theme © iAndrew 2016 - Forum software by © MyBB