Advertisement
dragonbe

Example DB setup

Feb 24th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. // application/Bootstrap.php
  2.     protected function _initDatabases()
  3.     {
  4.         $db = Zend_Db::factory('PDO_MySQL', array (
  5.             'hostname' => 'localhost',
  6.             'username' => 'zfessentials',
  7.             'password' => 'getsmart',
  8.             'dbname' => 'zfessentials',
  9.         ));
  10.     }
  11.  
  12.  
  13. // application/controllers/DatabaseController.php
  14.  
  15.     public function indexAction()
  16.     {  
  17.         $bootstrap = $this->getInvokeArg('bootstrap');
  18.         $db = $bootstrap->getResource('db');
  19.         $this->view->users = $db->fetchAll(
  20.                                 $db->select()
  21.                                    ->from('users'));
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement