Codeigniter 代码点火器更新错误?
我在更新时遇到问题,以下是我的看法:Codeigniter 代码点火器更新错误?,codeigniter,Codeigniter,我在更新时遇到问题,以下是我的看法: foreach($attributes as $dataIndex ){ $firstName = $dataIndex['first_name']; $f = array( 'name' => 'update_fname', 'value' => $firstName ); echo "<fieldset><label>First
foreach($attributes as $dataIndex ){
$firstName = $dataIndex['first_name'];
$f = array(
'name' => 'update_fname',
'value' => $firstName
);
echo "<fieldset><label>First Name:</label></br>".form_input($f)."</br>";
echo form_open(base_url()."index.php/home/save_update");
echo "<label>".form_submit('save_updates','Save')."</label>";
}
公共函数save_update(){
}这是为了省钱
这是我的模型:
公共函数get_属性($patientID){
我有一个错误:
遇到一个PHP错误
严重性:通知
消息:数组到字符串转换
文件名:database/DB\u active\u rec.php
电话号码:427
发生数据库错误
错误号码:1054
“where子句”中的未知列“Array”
更新患者
设置名字
=0,其中患者id
=数组
文件名:C:\xampp\htdocs\system\database\DB\u driver.php
电话号码:330
我想系统无法从我的数据库中获取患者id。
请提前帮我。试试这个
将数组设为
$f = array(
'update_fname' => $firstName);
在这样的单个更新数组集合中,我们也可以使用批处理更新
通过这个链接
http://ellislab.com/codeigniter/user-guide/database/active_record.html#update
$this->db->select('first_name, mid_name,
last_name, age, gender, b_day, marital_status, address, contact_num,
occupation, medical_record');
$this->db->from('patients');
$this->db->where('patient_id', $patientID);
return $this->db->get()->result_array();
}
public function save_attributes_by_id($patientID, $update){
$this->db->where('patient_id', $patientID)
->update('patients', $update, $patientID);
}
$f = array(
'update_fname' => $firstName);
http://ellislab.com/codeigniter/user-guide/database/active_record.html#update