I am trying to teach myself the Zend Framework. I have extensive experience using custom frameworks, but I have never used Zend. It is like trying to use a knife and fork with mittens.
My system is up and running. A database connection is created in the applition.ini file without errors.
The point I was in is trying to use this database connection to execute basic SQL. The .ini application has the lines:
db.adapter = PDO_MYSQL
db.params.host = localhost
db.params.username = cpanel_dbuser
db.params.password = 123456
db.params.dbname = cpanel_dbname
I am trying to connect to the database in my /public/index.php
$config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/application.ini', 'production');
$application->db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
The error I get is:
Fatal error: Uncaught exception 'Zend_Db_Exception' with message 'Adapter name must be specified in a string' in /home/path/library/Zend/Db.php:226
Stack trace:
And if I type r, the Config object
Zend_Config Object
(
[_allowModifications:protected] =>
[_index:protected] => 0
[_count:protected] => 2
[_data:protected] => Array
(
[adapter] => PDO_MYSQL
From my understanding of the tutorials and PDFs that I'm working on, if I get this connection, I will be able to make such fantastic amazements as from inside the indexAction controller
$data = $this->db->fetchAll(‘SELECT * FROM table’);
foreach ($data as $row) {
echo $row[‘table_fieldname’];
}
, .
, , .
- ( , )?