CI框架的事务无法实现
大家好,请问一下CI的事务如何实现,听说需要使用type=innodb,能不能针对我的代码来说明一下啊?O(∩_∩)O谢谢代码:
......
$this->db->trans_begin();
//[李毅]的银行账户总共就就是1000元
$this->db->query("update tb_bankaccount set money = money - 500000 where userName = '李毅'");
//转账给[张敏]
$this->db->query("update tb_bankaccount set money = money + 500000 where userName = '张敏'");
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback();
return log_message();
}
else
{
$this->db->trans_commit();
return 'seccess';
}
.... 请大家帮帮忙啊~谢谢 股沟百毒是好东西,以下转自百毒空间老王
“只要你的MySQL版本支持BDB或InnoDB表类型,那么你的MySQL就具有事务处理的能力”
只要你的mysql可以跑事务,CI就能跑事务 上楼正解
页:
[1]