Welcome Guest, Not a member yet? Register   Sign In
paging does not work on server
#1
Sad 

Sorry my bad english

I am working on a project in CodeIgniter 3.1.11, the project in general is working fine and everything, but there is a problem, in my local I use xampp, and the codeigniter paging system works fine, but when publishing on my server or any server does not work, does not show the page.

It would have to show me something like that but it doesn't: (example)
[Image: codeigniter-pagination-example-using-bootstrap.png]


I do not know what will be happening so that this is not showing it to me, and for the project it is essential that this is in operation.


here is my controller and model

Controller

PHP Code:
public function index()
    {
        $config = array();
        $user 0;

        if($this->session->userdata('login')){
            if($this->user->TIP == 2){
                $user $this->user->TIP;
                $this->list_car $this->ConModel->get_list_vh();
            }else if($this->user->TIP == 3){
                $user $this->user->TIP;
                $this->list_car $this->ConModel->get_list_vh_cli();
            }else{
                $this->list_car $this->ConModel->get_list_vh_cli();
            }
        }else{
            $this->list_car $this->ConModel->get_list_vh_cli();
        }
        
        $this
->load->library('pagination');

        $cont count($this->list_car);

        $config['base_url'] = base_url().'welcome';
        
$config['total_rows'] = $cont;
        $config['per_page'] = 5;
        $config["uri_segment"] = 2;
        

        $config
['num_links'] = 2;
        $config['use_page_numbers'] = true;
        $config['reuse_query_string'] = true;

        $config['full_tag_open'] = '<ul class="pagination">';
        
$config['full_tag_close'] = '</ul>';
        
$config['first_link'] = false;
        
$config['last_link'] = false;
        
        
$config['first_tag_open'] = '<li class="page-item page-link">';
        
$config['first_tag_close'] = '</li>';
        
$config['prev_link'] = '&laquo';
        
        
$config['prev_tag_open'] = '<li class="prev page-link"> ';
        
$config['prev_tag_close'] = '</li>';
        
$config['next_link'] = '&raquo';
        
        
$config['next_tag_open'] = '<li class="page-item page-link">';
        
$config['next_tag_close'] = '</li>';
        
        
$config['last_tag_open'] = '<li class="page-item page-link">';
        
$config['last_tag_close'] = '</li>';

        
$config['cur_tag_open'] = '<li class="page-item active"><a class="page-link" href="#">';
        
$config['cur_tag_close'] = '</a></li>';

        
$config['num_tag_open'] = '<li class="page-item page-link">';
        
$config['num_tag_close'] = '</li>';


        $this->pagination->initialize($config);

        $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;

        $post $this->ConModel->get_num_pagina($config['per_page'],$page$user);

        $data = array(
            'est' => 0,
            'doc' => $this->session->userdata('token'),
            'count' => $cont,
            'js' => 1,
            'script' => 'fil1.js',
            'lt' => $post,
            't' => $this->session->userdata('token'),
            'link' => $this->pagination->create_links()
        );
        
$this->load->view("layout/venta_init/header",$data);
        $this->load->view("venta/index");
        $this->load->view("layout/venta_init/footer");
    

Model

PHP Code:
public function get_list_vh_cli()
    {
        $query "SELECT
                    vt_venta_vh.id_vh_venta AS ID,
                    vt_venta_vh.marca AS MAR,
                    vt_venta_vh.modelo AS MO,
                    vt_venta_vh.version AS V,
                    vt_venta_vh.`year` AS A,
                    vt_venta_vh.kilometraje AS K,
                    vt_venta_vh.placa AS P,
                    vt_venta_vh.valor_venta AS VAL,
                    vt_venta_vh.op_valor AS OP,
                    vt_venta_vh.activo AS EST,
                    vt_venta_vh.pintura AS PI,
                    vt_venta_vh.interior AS IN_T,
                    vt_venta_vh.mecanico AS ME,
                    vt_venta_vh.accidente AS ACC,
                    vt_venta_vh.choque AS CHO,
                    vt_venta_vh.combustible AS COM,
                    vt_venta_vh.descripcion AS DES,
                    (SELECT vt_img.img FROM vt_img WHERE vt_img.id_vh = ID LIMIT 1) AS IMG,
                    vt_usuario.nombre AS NOM,
                    vt_usuario.apellido AS APE,
                    vt_usuario.telefono AS TEL,
                    vt_venta_vh.`user` AS US
                    FROM
                    vt_venta_vh
                    INNER JOIN vt_usuario ON vt_venta_vh.documento = vt_usuario.documento
                    WHERE vt_venta_vh.`user` = 1 AND vt_venta_vh.activo = 1"
;
        $dd $this->db->query($query);
        return $dd->result();
    }
    
    
//---------------------------------------------------------------------------
    public function get_num_pagina($limit,$offset$user)
    {
        $this->db->select('vt_venta_vh.id_vh_venta AS ID,vt_venta_vh.marca AS MAR,vt_venta_vh.modelo AS MO,vt_venta_vh.version AS V,vt_venta_vh.`year` AS A,vt_venta_vh.kilometraje AS K,vt_venta_vh.placa AS P,vt_venta_vh.valor_venta AS VAL,vt_venta_vh.op_valor AS OP,vt_venta_vh.activo AS EST,vt_venta_vh.pintura AS PI,vt_venta_vh.interior AS IN_T,vt_venta_vh.mecanico AS ME,vt_venta_vh.accidente AS ACC,vt_venta_vh.choque AS CHO,vt_venta_vh.combustible AS COM,vt_venta_vh.descripcion AS DES,(SELECT vt_img.img FROM vt_img WHERE vt_img.id_vh = ID LIMIT 1) AS IMG,vt_usuario.nombre AS NOM,vt_usuario.apellido AS APE,vt_usuario.telefono AS TEL,vt_venta_vh.`user` AS US');
        $this->db->join('vt_usuario','vt_venta_vh.documento = vt_usuario.documento');
        if($user != 0){
            $this->db->where('vt_venta_vh.`user`',$user);
        }
        $this->db->where('vt_venta_vh.activo',1);
        $this->db->limit($limit$offset);
        return $this->db->get('vt_venta_vh')->result();
    }

    public function get_num_pagina_bus($año$marca$modelo,$version,$comb,$k$user $check_val_10,$check_val_mx_4,$check_val_m_4)
    {
        $this->db->select('vt_venta_vh.id_vh_venta AS ID,vt_venta_vh.marca AS MAR,vt_venta_vh.modelo AS MO,vt_venta_vh.version AS V,vt_venta_vh.`year` AS A,vt_venta_vh.kilometraje AS K,vt_venta_vh.placa AS P,vt_venta_vh.valor_venta AS VAL,vt_venta_vh.op_valor AS OP,vt_venta_vh.activo AS EST,vt_venta_vh.pintura AS PI,vt_venta_vh.interior AS IN_T,vt_venta_vh.mecanico AS ME,vt_venta_vh.accidente AS ACC,vt_venta_vh.choque AS CHO,vt_venta_vh.combustible AS COM,vt_venta_vh.descripcion AS DES,(SELECT vt_img.img FROM vt_img WHERE vt_img.id_vh = ID LIMIT 1) AS IMG,vt_usuario.nombre AS NOM,vt_usuario.apellido AS APE,vt_usuario.telefono AS TEL,vt_venta_vh.`user` AS US');
        $this->db->from('vt_venta_vh');
        $this->db->join('vt_usuario','vt_venta_vh.documento = vt_usuario.documento');        
        $this
->db->where('vt_venta_vh.activo'1);
        if($user != 0){
            $this->db->where('vt_venta_vh.`user`',$user);
        }
        if($año != '0'){
            $this->db->where('vt_venta_vh.year',$año);
        }
        if($marca != '0'){
            $this->db->where('vt_venta_vh.marca',$marca);
        }
        
        
if($modelo != '0'){
            $this->db->where('vt_venta_vh.modelo',$modelo);
        }
        if($version != '0'){
            $this->db->where('vt_venta_vh.version',$version);
        }
        if($comb != '-1'){
            $this->db->where('vt_venta_vh.combustible',$comb);
        }

        if($k != '0'){
            if($k == 1){
                $this->db->where('vt_venta_vh.kilometraje >=','0');
                $this->db->where('vt_venta_vh.kilometraje <=','10000');
            }
            elseif($k == 2){
                $this->db->where('vt_venta_vh.kilometraje >=','10000');
                $this->db->where('vt_venta_vh.kilometraje <=','20000');
            }elseif($k == 3){
                $this->db->where('vt_venta_vh.kilometraje >=','21000');
                $this->db->where('vt_venta_vh.kilometraje <=','30000');
            }
            elseif($k == 4){
                $this->db->where('vt_venta_vh.kilometraje >=','31000');
                $this->db->where('vt_venta_vh.kilometraje <=','40000');
            }elseif($k == 5){
                $this->db->where('vt_venta_vh.kilometraje >=','41000');
                $this->db->where('vt_venta_vh.kilometraje <=','50000');
            }elseif($k == 6){
                $this->db->where('vt_venta_vh.kilometraje >=','51000');
                $this->db->where('vt_venta_vh.kilometraje <=','60000');
            }elseif($k == 7){
                $this->db->where('vt_venta_vh.kilometraje >=','61000');
            }

        }
        
        
if($check_val_10 != 0){
            $this->db->where('vt_venta_vh.valor_venta >=','0');
            $this->db->where('vt_venta_vh.valor_venta <=','10000000');
        }
        if($check_val_mx_4 != 0){
            $this->db->where('vt_venta_vh.valor_venta >=','11000000');
            $this->db->where('vt_venta_vh.valor_venta <=','40000000');
        }
        if($check_val_m_4 != 0){
            $this->db->where('vt_venta_vh.valor_venta >=','41000000');
        }
        return $this->db->get()->result();
    


Yes, I know that there is a lot of code redundancy and spaghetti code, but for now I am starting in the project and later it will be debugged.

If anyone knows why this error is generated, I would appreciate it very much
Reply
#2

(11-03-2020, 04:08 PM)alcadio Wrote: If anyone knows why this error is generated, I would appreciate it very much

What error? Copy the full error message so we can know what the problem is.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

(11-04-2020, 03:21 PM)includebeer Wrote:
(11-03-2020, 04:08 PM)alcadio Wrote: If anyone knows why this error is generated, I would appreciate it very much

What error? Copy the full error message so we can know what the problem is.
That is the problem that the log does not mark an error, it simply does not show the pagination to make the change of pages and show the rest of the information
Reply
#4

You may need to change your uri protocol in app/Config/app.php see below.

PHP Code:
/**
 * --------------------------------------------------------------------------
 * URI PROTOCOL
 * --------------------------------------------------------------------------
 *
 * This item determines which getServer global should be used to retrieve the
 * URI string.  The default setting of 'REQUEST_URI' works for most servers.
 * If your links do not seem to work, try one of the other delicious flavors:
 *
 * 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
 * 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
 * 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
 *
 * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
 *
 * @var string
 */
public $uriProtocol 'REQUEST_URI'
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(11-05-2020, 12:20 PM)InsiteFX Wrote: You may need to change your uri protocol in app/Config/app.php see below.

PHP Code:
/**
 * --------------------------------------------------------------------------
 * URI PROTOCOL
 * --------------------------------------------------------------------------
 *
 * This item determines which getServer global should be used to retrieve the
 * URI string.  The default setting of 'REQUEST_URI' works for most servers.
 * If your links do not seem to work, try one of the other delicious flavors:
 *
 * 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
 * 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
 * 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
 *
 * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
 *
 * @var string
 */
public $uriProtocol 'REQUEST_URI'

I have modified by the different options that {REQUEST_URI, QUERY_STRING, PATH_INFO} offers and it still does not show me the pagination
Reply
#6

I was doing some tests with var_dump ($ this-> pagination-> create_links ()) and what rotorna me is string (0) "", I have no idea why this, if anyone knows, please help me with this
Reply
#7

That means that it is not retrieving anything from the database check your queries.

See if they run in phpMyAdmin.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB