보기 CodeIgniter의 뷰 파일에 변수를 찾을 수 없습니다 :이
<table class="table table-hover">
<tr>
<th>Heading</th>
<th>Description</th>
</tr>
<?php foreach ($result as $row) { ?>
<tr>
<td><?php echo $row->heading_name ;?></td>
<td><?php echo $row->description_name; ?></td>
</tr>
<?php } ?>
</table>
모델 :
function view_description(){
$this->db->order_by("id","DESC");
$query = $this->db->get("description_update");
return $query->result();
}
컨트롤러 :
public function update_heading(){
$config = array(
array(
'field' =>'heading_name',
'label' =>'Name',
'rules' => 'trim|required'
),
array(
'field' => 'description_name',
'label' => 'Description',
'rules' => 'trim|required'
)
);
$this->form_validation->set_rules($config);
if ($this->form_validation->run()== FALSE)
{
$this->load->view('modules/admin/general.php');
}
else{
$data = array(
'heading_name' => $this->input->post('heading_name'),
'description_name' => $this->input->post('description_name')
);
$this->description_model->add_description($data);
$data['message'] = 'Data inserted Successfully';
$this->load->view('modules/admin/general.php',$data);
}
$data['result']= $this->description_model->view_description();
$this->load->view('modules/admin/general.php',$data);
// print_r($data);
}
내보기 파일에 결과 데이터를 보려는하지만, 그것은 결과 변수를 찾지 못했지만 $ 결과 데이터가 다른 뷰 파일에 결과를 보여줄 때 같은 코드에서 나타납니다. 무엇을해야할지 모르겠습니다. 참고 : 나는 CodeIgniter의
TIA
메시지가 제거되었지만 동일한 문제 메시지 : 정의되지 않은 변수 : 결과 – Arman