问题:adodb的事务处理为什么没效果?
解决方法:数据表都是InnoDB类型的,看下面的代码,第二条sql语句是错的,第一条语句却执行了
- include dirname(__FILE__).'adodbadodb.inc.PHP';
- include dirname(__FILE__).'bbsconfig.inc.PHP';
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- $db = &ADONewConnection('MysqL');
- $db->Connect($dbhost, $dbuser, $dbpw, $dbname);
- $db->debug=1;
- $db->StartTrans();
- $db->Execute("update table1 set fieldid=fieldid+1");
- $db->Execute("update table2 set joinid1=joinid+1 where id=11");
- $db->CompleteTrans();
- ?>
网上讨论比较多的是:
可是改了还是不行,网友建意:
- $db = &ADONewConnection('MysqL');
- $db->Connect($dbhost, $dbname);