Dimodel gw udah join antar tabel yg dibutuhkan untuk menampilkan nama propinsinya dengan menjoin tabelnya, tapi knp yang tampil tetap id nya ya? mohon bantuannya thanks b4, berikut codenya
<?php class Bps extends CI_Controller { //put your code here function __construct(){ parent::__construct(); $this->load->library('pagination'); $this->load->database(); $this->load->model('bpsmodel'); } function tampil($offset=0){ $limit = 10; $uri_segment = 3; $config['base_url']=site_url('bps/tampil'); $config['total_rows']=$this->bpsmodel->countdata('ukm'); $config['per_page']=$limit; $config['uri_segment']=$uri_segment; $config['full_tag_open'] = ''; $config['full_tag_close'] = ''; $this->pagination->initialize($config); $data['pagination']=$this->pagination->create_links(); $data['title'] = 'Test pagination'; $data['detail'] = $this->bpsmodel->get('ukm', $config['per_page'], $this->uri->segment(3)); $this->load->view('bpsview', $data); } } ?>
<?php class Bpsmodel extends CI_Model{ //put your code here function __construct(){ parent::__construct(); } var $table = 'ukm'; function countdata($table){ $this->db->SELECT('nama_propinsi', 'nama_kabupaten', 'nama_kecamatan', 'nama_desa','NBS','NSBS','NUS','jenis_sampel','NAMA,ALAMAT','RT','RW','KODEPOS','TELEPON','EXT','FAX','EMAIL','HOMEPAGE','kegiatan','nama_kategori','label','nama_pengusaha'); $this->db->FROM('$table'); $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'); $res = $this->db->get(); return $res->num_rows(); } function get($table,$limit,$offset) { $this->db->from($table)->limit($limit)->offset($offset); return $this->db->get()->result(); $query = $this->db->get($limit,$offset); } } ?>
<center> <h3>Tabel data Usaha Kecil dan Menengah<h3> </table> <table border=1 > <tr> <td>NO Pengusaha</td> <td>Propinsi</td> <td>Kabupaten</td> <td>Kecamatan</td> <td>Desa</td> <td>NBS</td> <td>NSBS</td> <td>NUS</td> <td>NUP</td> <td>Jenis Sampel</td> <td>Nama</td> <td>Alamat</td> <td>RT</td> <td>RW</td> <td>Kode Pos</td> <td>Telepon</td> <td>Ext</td> <td>Fax</td> <td>Email</td> <td>Homepage</td> <td>Kegiatan</td> <td>Kode Kategori</td> <td>Kode KBLI</td> <td>Nama Pengusaha</td> </tr> <?php foreach($detail as $row) : ?> <tr> <td><?php echo $row->id_pengusaha; ?></td> <td><?php echo $row->id_propinsi; ?></td> <td><?php echo $row->id_kabupaten; ?></td> <td><?php echo $row->id_kecamatan; ?></td> <td><?php echo $row->id_desa; ?></td> <td><?php echo $row->NBS; ?></td> <td><?php echo $row->NSBS; ?></td> <td><?php echo $row->NUS; ?></td> <td><?php echo $row->NUP; ?></td> <td><?php echo $row->jenis_sampel; ?></td> <td><?php echo $row->NAMA; ?></td> <td><?php echo $row->ALAMAT; ?></td> <td><?php echo $row->RT; ?></td> <td><?php echo $row->RW; ?></td> <td><?php echo $row->KODEPOS; ?></td> <td><?php echo $row->TELEPON; ?></td> <td><?php echo $row->EXT; ?></td> <td><?php echo $row->FAX; ?></td> <td><?php echo $row->EMAIL; ?></td> <td><?php echo $row->HOMEPAGE; ?></td> <td><?php echo $row->kegiatan; ?></td> <td><?php echo $row->kode_kategori; ?></td> <td><?php echo $row->kode_kbli; ?></td> <td><?php echo $row->nama_pengusaha; ?></td> </td> </tr> <?php endforeach; ?> <?php echo $this->pagination->create_links(); ?> </table>
Comments
cek ulang bagian ini
October 6, 2011 by predhtz, 1 day 2 hours ago
Comment: 9099
cek ulang bagian ini bro....
mungkin yang dimaksud
Tetap ga bisa muncul
October 6, 2011 by zacksyah, 1 day 1 hour ago
Comment: 9100
Tetap ga bisa muncul error
Yang di model tambahin
October 7, 2011 by purandi, 17 hours 19 min ago
Comment: 9103
Yang di model tambahin
msh error gan: Fatal error:
October 7, 2011 by zacksyah, 17 hours 6 min ago
Comment: 9104
msh error gan:
Fatal error: Call to undefined method Bpsmodel::from() in C:\xampp\htdocs\ci\application\models\bpsmodel.php on line 45
public function
October 7, 2011 by purandi, 16 hours 42 min ago
Comment: 9105
msh gan error: Fatal error:
October 7, 2011 by zacksyah, 16 hours 20 min ago
Comment: 9106
msh gan error:
Fatal error: Call to undefined method Bpsmodel::from() in C:\xampp\htdocs\ci\application\models\bpsmodel.php on line 40
coba deh anda copas modelnya
October 7, 2011 by purandi, 16 hours 8 min ago
Comment: 9107
coba deh anda copas modelnya di http://scrp.at/.
nanti kasih tahu linknya
http://scrp.at/au6
October 7, 2011 by zacksyah, 7 hours 26 min ago
Comment: 9109
http://scrp.at/au6