[eluser]zacksyah[/eluser]
I cannot display province_name, regency_name, sub-district_name, village_name, sample_name & some other.
This is my code
Controllrer
Code:
<?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);
}
}
?>
Model
Code:
<?php
class Bpsmodel extends CI_Model{
//put your code here
function __construct(){
parent::__construct();
}
var $table = 'ukm';
function countdata($table){
$this->db->SELECT('province_name', 'regency_name', 'sub-district_name', 'village_name','NBS','NSBS','NUS','sample_type','name','address','RT','RW','zip_code','phone','EXT','FAX','EMAIL','HOMEPAGE','activity','category_code','lable','business_name');
$this->db->FROM('$table');
$this->db->JOIN('village','ukm.village_id = desa.village_id');
$this->db->JOIN('sub-district','village.sub-district_id= sub-district.sub-district_id');
$this->db->JOIN('regency','sub-district.regency_id = regency.regency_id');
$this->db->JOIN('province','regency.province_id = province.province_id');
$this->db->JOIN('kbli','ukm.kbli_code = kbli.kbli_code');
$this->db->JOIN('category','kbli.category_code = category.category_code');
$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);
}
}
?>
View
Code:
<center>
<h3>Tabel data Usaha Kecil dan Menengah<h3>
</table>
<table border=1 >
<tr>
<td>No businessman</td>
<td>province</td>
<td>regency</td>
<td>sub-district</td>
<td>Village</td>
<td>NBS</td>
<td>NSBS</td>
<td>NUS</td>
<td>NUP</td>
<td>Sample Type</td>
<td>Name</td>
<td>Address</td>
<td>RT</td>
<td>RW</td>
<td>Zip code</td>
<td>Phone</td>
<td>Ext</td>
<td>Fax</td>
<td>Email</td>
<td>Homepage</td>
<td>Activity</td>
<td>Category Name</td>
<td>lable</td>
<td>business_name</td>
</tr>
<?php foreach($detail as $row) : ?>
<tr>
<td><?php echo $row->id_pengusaha; ?></td>
<td><?php echo $row->province_id; ?></td>
<td><?php echo $row->regency_id; ?></td>
<td><?php echo $row->sub-district_idn; ?></td>
<td><?php echo $row->village_id; ?></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->sample_type; ?></td>
<td><?php echo $row->Name; ?></td>
<td><?php echo $row->Address; ?></td>
<td><?php echo $row->RT; ?></td>
<td><?php echo $row->RW; ?></td>
<td><?php echo $row->zip_code; ?></td>
<td><?php echo $row->phone; ?></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->activity; ?></td>
<td><?php echo $row->category_code; ?></td>
<td><?php echo $row->kbli_code; ?></td>
<td><?php echo $row->business_name; ?></td>
</td>
</tr>
<?php endforeach; ?>
<?php echo $this->pagination->create_links(); ?>
</table>
whether there is something wrong in my view & model file?
please help thanks b4