Advertisement
Guest User

Untitled

a guest
Feb 19th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. class Database
  2. {
  3. private
  4. $database,
  5. $dbhost = '', // usually localhost
  6. $dbname = '',
  7. $dbuser = '',
  8. $dbpass = ''
  9. ;
  10.  
  11. public function __construct( )
  12. {
  13. $this->database = new mysqli( $this->dbhost, $this->dbuser, $this->dbpass, $this->dbname );
  14.  
  15. if( $this->database->connect_errno)
  16. {
  17. die( "Failed to connect to MySQL: (" . $this->database->connect_errno . ") " . $this->database->connect_error );
  18. }
  19. }
  20.  
  21. function get_connection( )
  22. {
  23. return $this->database;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement