• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unsupported operand types

#1
[eluser]zacksyah[/eluser]
I have error with pagination
Code:
<?php

class Bos extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->model('bos_model');
        $this->load->helper('html');
    }

    function index($offset = 0) {
$limit = 5;
        $uri_segment = 3;
        $offset = $this->uri->segment($uri_segment);
        $bps = $this->bos_model->tampilan(5, $offset);

        $config['base_url'] = site_url() . '/bos/index';
        $config['total_rows'] = $this->bos_model->count_all();
        $config['per_page'] = $limit;
        $config['uri_segment'] = $uri_segment;
        $this->pagination->initialize($config);

        $data['tampilan'] = $bps;
        $data['create_links'] = $this->pagination->create_links();
        $this->load->view('bos_view', $data);
        
    }

    function cari($offset = 0) {
        $limit = 5;
        $uri_segment = 3;

        $config['base_url'] = site_url('bos/cari');
        $config['total_rows'] = $this->bos_model->total_pencarian('bps');
        $config['per_page'] = $limit;
        $config['uri_segment'] = $uri_segment;
        $config['full_tag_open'] = '';
        $config['full_tag_close'] = '';
        $this->pagination->initialize($config);

        $data['create_links'] = $this->pagination->create_links();
        $data['tampilan'] = $this->bos_model->caridata();
        $data['total_pencarian'] = $this->bos_model->total_pencarian();

        if ($data['total_pencarian'] == NULL) {
            echo "data tidak ada";
            echo anchor('bos', 'kembali');
        } else {
            $this->load->view('bos_view', $data);
        }
    }

}

?>

Code:
<?php

class bos_model extends CI_Model {

    function tampilan($limit = 5, $offset = 0) {
        $this->db->select('nama_propinsi, nama_kabupaten, nama_kecamatan, nama_desa,NBS,NSBS,NUS,nama_sampel,NAMA,ALAMAT,RT,RW,KODEPOS,TELEPON,EXT,FAX,EMAIL,HOMEPAGE,kegiatan,nama_kategori,label,nama_pengusaha', $limit, $offset);
        $this->db->from('ukm');
        $this->db->JOIN('desa', 'ukm.id_desa = desa.id_desa');
        $this->db->JOIN('kecamatan', 'desa.id_kecamatan = kecamatan.id_kecamatan');
        $this->db->JOIN('kabupaten', 'kecamatan.id_kabupaten = kabupaten.id_kabupaten');
        $this->db->JOIN('propinsi', 'kabupaten.id_propinsi = propinsi.id_propinsi');
        $this->db->JOIN('kbli', 'ukm.kode_kbli = kbli.kode_kbli');
        $this->db->JOIN('tbl_kategori', 'kbli.kode_kategori = tbl_kategori.kode_kategori');
        $this->db->JOIN('sampel ', 'ukm.jenis_sampel = sampel.jenis_sampel');  
        $this->db->limit($limit,$offset);
        return $this->db->get()->result();
    }

    function count_all() {
        $this->db->select('count(*) as num');
        return $this->db->get()->result();
    }

    function caridata($limit = 5, $offset = 0) {
        $this->input->POST('cari');
        $this->db->like('nama_pengusaha', $c);
        $this->db->select('nama_propinsi, nama_kabupaten, nama_kecamatan,  nama_desa,NBS,NSBS,NUS,nama_sampel,NAMA,ALAMAT,RT,RW,KODEPOS,TELEPON,EXT,FAX,EMAIL,HOMEPAGE,kegiatan,nama_kategori,label,nama_pengusaha', $limit, $offset);
        $this->db->from('ukm');
        $this->db->JOIN('desa', 'ukm.id_desa = desa.id_desa');
        $this->db->JOIN('kecamatan', 'desa.id_kecamatan = kecamatan.id_kecamatan');
        $this->db->JOIN('kabupaten', 'kecamatan.id_kabupaten = kabupaten.id_kabupaten');
        $this->db->JOIN('propinsi', 'kabupaten.id_propinsi = propinsi.id_propinsi');
        $this->db->JOIN('kbli', 'ukm.kode_kbli = kbli.kode_kbli');
        $this->db->JOIN('tbl_kategori', 'kbli.kode_kategori = tbl_kategori.kode_kategori');
        $this->db->JOIN('sampel ', 'ukm.jenis_sampel = sampel.jenis_sampel');  
        $this->db->limit($limit,$offset);
        return $this->db->get()->result();
    }

    function total_pencarian() {
        $c = $this->input->POST('cari');
        $this->db->like('nama_pengusaha', $c);
        $query = $this->db->select('nama_propinsi, nama_kabupaten, nama_kecamatan, nama_desa,NBS,NSBS,NUS,nama_sampel,NAMA,ALAMAT,RT,RW,KODEPOS,TELEPON,EXT,FAX,EMAIL,HOMEPAGE,kegiatan,nama_kategori,label,nama_pengusaha FROM ukm');
        return $query->num_rows();
    }

}

?>
and the error
Code:
Fatal error: Unsupported operand types in C:\xampp\htdocs\ci\system\libraries\Pagination.php on line 123
please help me, is it error code? thanks in advance


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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