我正在尝试使用Zend TableGateway作为我的应用程序(而不是ZF2)的独立组件。
下面是一个简单的测试脚本,只获取一些行,但我得到了错误
Uncaught 'Zend\Db\Adapter\ exception \RuntimeException‘在未缓冲的结果集中无法使用行计数。在/var/www/shared-views-slim/vendor/zendframework/zend-db/Zend/Db/Adapter/Driver/Mysqli/Result.php:324中
下面是我的代码:
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// require composer autoloader for loading classes
require 'vendor/autoload.php';
// testing
$adapter = new Zend\Db\Adapter\Adapter(array(
'driver' => 'Mysqli',
'database' => 'budget_development',
'username' => 'root',
'password' => 'mypasswd'
));
use Zend\Db\TableGateway\TableGateway;
$accountsTable = new TableGateway('accounts', $adapter);
// search for at most 2 artists who's name starts with Brit, ascending
$rowset = $accountsTable->select();
var_dump($rowset);有人知道我怎么解决这个问题吗?我真的不明白它需要我做什么。
发布于 2014-11-04 09:01:21
您已经使用了缓冲结果,通常用于大型数据集。因为你只是寻找艺术家(如你的评论),这是不必要的。
可能有一个ini文件集,其内容如下:
'db' => array(
'options' => array(
'buffer_results' => true,
),(这是buffer_results部分)。
提示:看看config/autoload/global.php,它就在我的应用程序中。
发布于 2015-03-24 21:44:50
也许有人能帮上忙
'driver' => 'PdoMysql',使用PdoMysql驱动程序。这是我的工作
https://stackoverflow.com/questions/26702870
复制相似问题