Home > Article > Backend Development > There is a problem with pdo when php executes a transaction, transaction pdo_PHP tutorial
The new version of pdo will have this problem:
General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in. . .
It means either using fetchAll() or using the attribute MYSQL_ATTR_USE_BUFFERED_QUERY. The former does not want to use it because it is worried about occupying memory, and the latter finds it has no effect.
<span>$this</span>->db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, <span>true</span>);
Reference blog:
http://www.flashj.cn/wp/pdo-transaction-err-in-php.html