6
我正在使用codeigniter版本2.0.3。我试图用
$this->db->affected_rows
它总是返回即使没有行已更新1更新查询后得到受影响的行数。我试着用
mysql_affected_rows()
它返回-1为查询失败和0如果没有记录已更新。
编辑包括我的代码
我只是用
$country_id = $this->input->post('country_id');
$time=$this->input->post('time');
$insert_array = array(
'country' => $this->input->post('name')
);
$this->db->update('country_master', $insert_array, array("country_id" => $country_id,"last_updated"=>$time));
$afftectedRows=$this->db->affected_rows();
你介意显示你的代码吗? – 2011-12-22 16:05:21
这取决于您之前使用的查询 $ this-> db-> affected_rows 如果您可以显示您的代码,将很容易共享该解决方案。 – 2011-12-22 16:48:31
H'mmm这是我的错误,现在工作正常 – Nick 2011-12-23 09:13:57