记录一下使用中PDO出现的一个问题:Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll().

在使用PDO的时候,一条sql语句打死都不执行,dump一下errorInfo试试,出现这样的错误信息

问题描述

array(3) {
[0]=>
string(5) "HY000"
[1]=>
int(2014)
[2]=>
string(269) "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."
}

居然告诉我还有语句没有执行完成?当前的查询未能执行,逗我么!考虑使用fetchAll,或者开启缓冲查询,行,你说得对….

问题出现的使用场景

服务器

服务器为linux,安装了一个什么面板套件之类的,不是自家机器,也懒得去折腾,在本地的windows环境并没有该问题。 (更多…)

你可能还喜欢下面这些文章

使用php curl 的并发能力可以做什么

在php中,没有多线程让编程变得简单。但在一些需要并发提升性能的场景下,显得有些无能为力,比如发起一些http请求。但好在curl扩展可以让我们“并发”去请求网络资源。利用这个特点,我们能做很多有趣的事情。最基础的,并发请求网络资源,提升处理速度。并发访问代码<?phpclass ConcurrencyHTTP { private $_requests; private $_callbacks; private $_currentIndex = 0; public function get($url, $header = array(), $timeout = 3