我正在 CodeIgniter 中的表上运行 update_batch(),我想检查它是否成功。
我尝试过使用affected_rows(),但这只计算已修改的表单字段的数量,因此并不能完全减少它:
$this->db->update_batch("sections", $data, "alias");
log_message("debug", "items in form: ".count($data));
// items in form: 3
log_message("debug", "rows updated: ".$this->db->affected_rows());
// rows updated: 0-3
// depending on whether anything was actually changed on the form
return ($this->db->affected_rows() == count($data)); // unreliable
从批量更新功能中询问似乎是一件相当简单的事情。有什么我错过了或者我应该编写自己的批量更新代码吗?
$this->db->trans_start();
$this->db->update_batch($table, $update, $variable);
$this->db->trans_complete();
return ($this->db->trans_status() === FALSE)? FALSE:TRUE;
希望这可以帮助!。干杯!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)