Guest User

Untitled

a guest
Feb 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. class dbconnect{
  4. protected $db_name = 'abcc';
  5. protected $db_user = 'root';
  6. protected $db_pass = '';
  7. protected $db_host = 'localhost';
  8.  
  9. // Open a connect to the database.
  10. // Make sure this is called on every page that needs to use the database.
  11.  
  12. public function connect() {
  13.  
  14. $connect_db = new mysqli( $this->db_host, $this->db_user, $this-
  15. >db_pass, $this->db_name );
  16.  
  17. if ( mysqli_connect_errno() ) {
  18. printf("Connection failed: %s", mysqli_connect_error());
  19. exit();
  20. }
  21. return $connect_db;
  22. }
  23.  
  24. }}
Add Comment
Please, Sign In to add comment