Guest User

Untitled

a guest
May 23rd, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1.  
  2. application.ini
  3. [production]
  4. resources.view[] =
  5. resources.db.adapter = PDO_MYSQL
  6. resources.db.params.host = localhost
  7. resources.db.params.username = xxxx
  8. resources.db.params.password = xxxx
  9. resources.db.params.dbname = mydb
  10. resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
  11. ; following line added
  12. resources.db.params.profiler.enabled = "true"
  13. resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug"
  14.  
  15. <?php
  16. class LoginController extends Zend_Controller_Action
  17. {
  18. public function indexAction()
  19. {
  20. // Database connection
  21. $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
  22. // we already told in our application ini else
  23. //$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
  24. //$profiler->setEnabled(true);
  25. $db = Zend_Db::factory($config->resources->db);
  26. $this->db = $db;
  27. // this query will be showing in profiler
  28. $db->query("select *from clients");
  29. /**
  30. Zend_Db_Profiler_Firebug (2 @ 0.000180 sec)
  31. Time Event Parameters
  32. ==== ===== ===========
  33. 0.00061 connect NULL
  34. 0.00057 select *from clients NULL
  35.  
  36. */
  37. }
  38. }
Add Comment
Please, Sign In to add comment