Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP中的存储过程错误_Php_Mysql_Stored Procedures_Mysqli_Cakephp 2.1 - Fatal编程技术网

CakePHP中的存储过程错误

CakePHP中的存储过程错误,php,mysql,stored-procedures,mysqli,cakephp-2.1,Php,Mysql,Stored Procedures,Mysqli,Cakephp 2.1,知道如何在CakePHP中调用存储过程吗 $results = $this->query('call p2'); echo $results; 不过,我一直会遇到这样的错误: Error: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Altern

知道如何在CakePHP中调用存储过程吗

$results = $this->query('call p2');
echo $results;
不过,我一直会遇到这样的错误:

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.

我在事务中这样做是为了确保没有其他过程实例被称为中间过程:

$this->begin();
$this->query("CALL procedure();");
$result = $this->query("SELECT something");
$this->commit();
您的问题可能是您正在拨打:

$this->query('call p2');
$this->query('call p2()');
您应该拨打的电话:

$this->query('call p2');
$this->query('call p2()');

因为过程很像函数。

你应该打开和关闭括号

$results = $this->query('call p2()');
echo $results;

答案应该是详细的。