Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. class Customers_model extends CI_Model
  2. {
  3. public function __construct()
  4. {
  5. parent::__construct();
  6.  
  7. $this->db = $this->load->database($this->user->getDatabase(), TRUE);
  8. }
  9. }
  10.  
  11. public function getDatabase()
  12. {
  13. $config['hostname'] = 'localhost';
  14. $config['username'] = 'root';
  15. $config['password'] = '';
  16. $config['database'] = $this->session->user['database'];
  17. $config['dbdriver'] = 'mysqli';
  18.  
  19. return $config;
  20. }
  21.  
  22. return array(
  23.  
  24. 'default' => 'mysql',
  25.  
  26. 'connections' => array(
  27.  
  28. # Primary/Default database connection
  29. 'mysql' => array(
  30. 'driver' => 'mysql',
  31. 'host' => '127.0.0.1',
  32. 'database' => 'database1',
  33. 'username' => 'root',
  34. 'password' => 'secret'
  35. 'charset' => 'utf8',
  36. 'collation' => 'utf8_unicode_ci',
  37. 'prefix' => '',
  38. ),
  39.  
  40. # Secondary database connection
  41. 'mysql2' => array(
  42. 'driver' => 'mysql',
  43. 'host' => '127.0.0.1',
  44. 'database' => 'database2',
  45. 'username' => 'root',
  46. 'password' => 'secret'
  47. 'charset' => 'utf8',
  48. 'collation' => 'utf8_unicode_ci',
  49. 'prefix' => '',
  50. ),
  51. ),
  52. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement