Guest User

Untitled

a guest
Aug 15th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. // in your application.ini
  4.  
  5. ; database data
  6. resources.db.adapter = "mysqli" // or pdo_msql
  7. resources.db.params.username = "username"
  8. resources.db.params.host = "localhost"
  9. resources.db.params.dbname = "NameOfDb"
  10. resources.db.params.password = "UserPassword"
  11. resources.db.params.charset = "utf8"
  12.  
  13. // in your bootstrap to add the db to the registry
  14.  
  15. protected function _initDbAdapter() {
  16. $this->bootstrap('db');
  17. $db = $this->getResource('db');
  18. if ($db != null) {
  19. Zend_Registry::set('db', $db);
  20. } else {
  21. throw new Exception('cannot create database adapter');
  22. }
  23. Zend_Db_Table_Abstract::setDefaultAdapter($db);
  24. }
Add Comment
Please, Sign In to add comment