Guest User

Untitled

a guest
Dec 12th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <?php
  2.  
  3. protected $active_group;
  4. protected $db2;
  5.  
  6. public function __construct() {
  7.  
  8. parent::__construct();
  9. $this->connect();
  10. }
  11.  
  12. $this->db->close();
  13. }
  14.  
  15. public function connect($active_group = 'default'){
  16.  
  17. $this->active_group = $active_group;
  18. $db = $this->load->database($active_group, TRUE);
  19. $this->db = $db;
  20.  
  21. $db['second'] = array(
  22. 'dsn' => '',
  23. 'hostname' => 'localhost',
  24. 'username' => 'root',
  25. 'password' => '',
  26. 'database' => 'nomedobanco',
  27. 'dbdriver' => 'mysqli',
  28. 'dbprefix' => '',
  29. 'pconnect' => FALSE,
  30. 'db_debug' => (ENVIRONMENT !== 'production'),
  31. 'cache_on' => FALSE,
  32. 'cachedir' => '',
  33. 'char_set' => 'utf8',
  34. 'dbcollat' => 'utf8_general_ci',
  35. 'swap_pre' => '',
  36. 'encrypt' => FALSE,
  37. 'compress' => FALSE,
  38. 'stricton' => FALSE,
  39. 'failover' => array(),
  40. 'save_queries' => TRUE
  41. );
  42.  
  43. //$db2 = $this->load->database('second', TRUE);
  44. $this->db2 = $db;
  45. }
Add Comment
Please, Sign In to add comment