为什么我的更新操作一定要执行两遍才有效果?
$this->load->database();
$this->db->trans_start();
$data = array(
'name' => $this->input->post('name'),
'type' => $this->input->post('type'),
'province' => $this->input->post('province'),
'city' => $this->input->post('city'),
'county' => $this->input->post('county'),
'first_money' => $this->input->post('first_money'),
'year_money'=> $this->input->post('year_money'),
'margin' => $this->input->post('margin'),
'period' => $this->input->post('period'),
'start_date'=> $this->input->post('start_date'),
'end_date' => $this->input->post('end_date')
);
$this->db->where('id',$id);
$this->db->update($this->c_table,$data);
// $this->_edit_ext();
($this->db->trans_status() === FALSE)?
$act=FALSE :
$act=TRUE ;
return $act;
上面是代码片段,一定要执行两遍 数据库里面的数据才有变化。我开启了调试功能 但是第一次执行的时候显示执行了SQL语句,就是数据库里没有效果! 都没有人啊?求助啊! 你用事物,你只是start了,没$this->db->trans_complete();,就是没有commit??? 回复 3# jeongee
:L多谢高手!
页:
[1]