I'm trying to use Zend TableGateway
as a stand alone component with my app (not ZF2).
Below is a simple test script to just fetch some rows but I get the error
Uncaught exception 'Zend\Db\Adapter\Exception\RuntimeException' with message 'Row count is not available in unbuffered result sets.' in /var/www/shared-views-slim/vendor/zendframework/zend-db/Zend/Db/Adapter/Driver/Mysqli/Result.php:324
Below is my code:
/**
* 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);
Does anyone know how I can fix this? I don't really understand what it needs me to do.
You have used buffered results, which are normally used for big datasets. As you are looking for just to artists (as you comments say), this is not needed.
There's probably an ini file set with something like:
(it's the buffer_results part).
Hint: take a look in config/autoload/global.php, that's where it was in my app.
Maybe some one help this
Use PdoMysql driver . This Works 4 me