I am doing a PDO::exec
command on multiple updates:
$MyPdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
$MyPdo->exec("update t1 set f1=1;update t2 set f1=2");
I am doing it inside a transaction, and I keep getting the following error:
SQLSTATE[HY000]: 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.
those are the only query/ies
You shouldn't execute the statements as a single query. Execute them one at a time:
I encountered the same problem, and haven't found any solution:
Before php 5.3 you could close connection by destroy $pdo, in php 5.3+, you could use $pdo->query() to execute multi-query, take care that $pdo->exec() finished does not mean the sql server finished the execution:
for diyism