hola amigos como hago la conexion en zend frameworkm xq no muestra nada por la pantalla
hice asi:
aplication/views/script/index/index.phtml :
Código PHP:
<?php
$options = array(
Zend_Db::ALLOW_SERIALIZATION => false
);
$params = array(
'host' => 'localhost',
'username' => 'root',
'password' => '123456',
'dbname' => 'test',
'options' => $options
);
$db = Zend_Db::factory('Pdo_Mysql', $params);
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$result = $db->fetchAll('SELECT * FROM bugs WHERE bug_id = 1', 2);
// $result is an array of objects
echo $result[0]->bug_description;
y en public / index.php
Código PHP:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
$options = array(
Zend_Db::ALLOW_SERIALIZATION => false
);