I get 2014 Cannot execute queries while other unbuffered queries are active when doing exec with PDO

Posted by Itay Moav on Stack Overflow See other posts from Stack Overflow or by Itay Moav
Published on 2009-11-25T15:28:16Z Indexed on 2010/05/19 2:40 UTC
Read the original article Hit count: 307

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:

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

© Stack Overflow or respective owner

Related posts about pdo

Related posts about php