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