tags:

views:

148

answers:

2

Working through a zend tutorial & get this message, & not sure where to look.

thanks,

An error occurred
Application error
Exception information:

Message: No adapter found for Model_DbTable_Books
Stack trace:

#0 C:\xampp\php\PEAR\Zend\Db\Table\Abstract.php(739): Zend_Db_Table_Abstract->_setupDatabaseAdapter()
#1 C:\xampp\php\PEAR\Zend\Db\Table\Abstract.php(268): Zend_Db_Table_Abstract->_setup()
#2 C:\xampp\htdocs\zftutorials\zftutorial\application\controllers\BooksController.php(34): Zend_Db_Table_Abstract->__construct()
#3 C:\xampp\php\PEAR\Zend\Controller\Action.php(513): BooksController->listAction()
#4 C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('listAction')
#5 C:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:\xampp\php\PEAR\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#7 C:\xampp\php\PEAR\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:\xampp\htdocs\zftutorials\zftutorial\public\index.php(26): Zend_Application->run()
#9 {main}  

Request Parameters:

array (
  'controller' => 'books',
  'action' => 'list',
  'module' => 'default',
)  
+1  A: 

To connect to database use:

$db = Zend_Db::factory('Pdo_Mysql', array(
     'host'     => '127.0.0.1',
     'username' => 'webuser',
     'password' => 'xxxxxxxx',
     'dbname'   => 'test'
));

And to set a default adapter:

Zend_Db_Table::setDefaultAdapter($dbAdapter);

There are some ways to set a specific adapter to a table without configure the default adapter and etc....

You can see more details in documentation... please, read it :D

[]'s

Felipe Cardoso Martins
+1  A: 

Felipe was correct, while the tutorial required this set up in application.ini file.

resources.db.adapter = mysqli
resources.db.params.host = localhost
resources.db.params.username = user
resources.db.params.password = pw
resources.db.params.dbname = test
roger rover