Mysqli rollback not working

女生的网名这么多〃 提交于 2019-12-11 10:29:30

问题


The Mysqli documentation indicates that if the call autocommit(false) returns true, it was successful in disabling the automatic committing of queries.
Still, if I try to rollback the transaction, created like the following code, the information remains deleted.

$dbConn= new mysqli($host, $user, $pass, $db) or die('Could not connect');
$dbConn->autcocommit(false); //returns true
$dbConn->query($deleteQuery);
$dbConn->query($deleteQuery2);
$dbConn->rollback();

What could go wrong in this situation?


回答1:


Rollback only works with InnoDB tables not MyISAM. Make sure the tables you are using in $deleteQuery (query) is InnoDB.



来源:https://stackoverflow.com/questions/19219368/mysqli-rollback-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!