We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How can I fix "General error: 2014 Cannot execute queries while other unbuffered queries are active."?

Hello, I was using raw sql queries without any problems when this error appear. I was querying for a resulset from a table and then a count from all the records and this error appears. How can fix this?


I'm not a Phalcon expert, but this sounds a lot like a general problem that can occur when you are using PDO that I've run into when using other frameworks. Basically, it happens when you send one raw PDO statement and then another without resetting the cursor in between.

You need to call ::closeCursor() on your PDOStatement object in between queries.

See: https://stackoverflow.com/questions/2066714/pdo-cannot-execute-queries-while-other-unbuffered-queries-are-active


Apparently I just wrote a bad SQL sentence... touching here and there I solved the error.... Thanks XyploatKyrt.