我有我的代碼問題我使用codeigniter,我是新來這個框架,所以任何幫助將不勝感激,這是我的問題: 我試圖獲得我的數據庫中的特定屬性,我可以用於更新。現在Codeigniter錯誤信息?
嚴重性:注意
消息:未定義指數:LAST_NAME
文件名:視圖/ edit_patient_view.php
行號:11
那麼這是我的控制器:
public function edit_patient($patientID){
if($patientID=== null){
return;
redirect('home/view_patient');
}
$data["patient"] = $this->patient_manager->edit_patient($patientID);
$this->load->view("edit_patient_view", $data);
}
這是我的模特:
public function edit_patient($patientID){
$this->db->select('first_name', 'last_name');
$this->db->from('patients');
if (!is_null($patientID)) $this->db->where('patient_id', $patientID);
return $this->db->get()->result_array();
}
這是我的看法:
<!DOCTYPE html>
<head><title>Edit Patient</title>
</head>
<body>
<?php
for($i = 0; $i < count($patient); $i++){
$patients = $patient[$i];
echo "<h1>Editing Patient Information</h1>";
echo "First name:".form_input($patients['first_name'])."<br/>";
}
?>
</form>
</html>
附加代碼爲姓氏字段 –
沒有的這個文件的觀點13/edit_patient_view.php您的陣列是指還沒有定義「last_name的」。 – Deepak
只是檢查您訪問其$患者的名稱不是$患者 –