我想从表kendala获取数据N_KENDALA。表"肯达拉"加入Table" Pelayanan"
这是我的控制器 - > pelayanan.php
DataTable
这是我的模特 - > model_pelayanan.php
public function ubah($ID_PELAYANAN){
$data['Kendala'] = $this->model_pelayanan->kendala();
$data['Isi'] = $this->model_pelayanan->detail($ID_PELAYANAN);
$this->load->view('admin/start');
$this->load->view('admin/header', $data);
$this->load->view('admin/pelayanan_ubah', $data);
$this->load->view('admin/footer');
$this->load->view('admin/script_textarea');
$this->load->view('admin/end');
}
这是我对梳子盒的看法 - > pelayanan_ubah.php
public function detail($ID_PELAYANAN){
$this->db->select('*');
$this->db->from('pelayanan');
$this->db->join('area', 'area.ID_AREA = pelayanan.ID_AREA', 'left');
$this->db->join('rayon', 'rayon.ID_RAYON = pelayanan.ID_RAYON', 'left');
$this->db->join('status', 'status.ID_STATUS = pelayanan.ID_STATUS', 'left');
$this->db->join('kendala', 'kendala.ID_KENDALA = pelayanan.ID_KENDALA', 'left');
$this->db->join('verifikasi', 'verifikasi.ID_VERIFIKASI = pelayanan.ID_VERIFIKASI', 'left');
$this->db->order_by('ID_PELAYANAN', 'asc');
$this->db->where('pelayanan.ID_PELAYANAN', $ID_PELAYANAN);
$query = $this->db->get();
if ($query->num_rows()) {
return $query->result_array();
}
else {
return false;
}
}
public function kendala(){
$this->db->select('*');
$this->db->from('KENDALA');
$query = $this->db->get();
if ($query->num_rows()) {
return $query->result_array();
}
else {
return false;
}
}
但是,当我跑步时,组合框的值不显示。
如何解决这个问题?
答案 0 :(得分:4)
您遇到的问题是,传递给视图的数据是上层驼峰大小写,但您尝试迭代的变量是大写的,请注意以下几点:
public function ubah($ID_PELAYANAN){
$data['Kendala'] (...) <-- upper camel case
但是,在您看来,您正在使用:
foreach ($KENDALA as $row) { <-- capitalized
(...)
请将$KENDALA
更改为$Kendala