Database Connection Class


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. /** *******************************************************************
  4. * MySnippets
  5. * Free for use
  6. *
  7. * @author Jonnie Spratley
  8. * @contact [email protected]
  9. ******************************************************************* */
  10. class Database
  11. {
  12. //Enter your credentials
  13. public $db_host = "HOST";
  14. public $db_name = "DATABASE";
  15. public $db_user = "USER";
  16. public $db_pass = "PASSWORD";
  17. public $dbconn;
  18.  
  19. /**
  20. * Enter description here...
  21. *
  22. * @return Database
  23. */
  24. public function Database()
  25. {
  26. $this->dbconn = mysql_connect( $this->db_host, $this->db_user, $this->db_pass );
  27.  
  28. mysql_select_db( $this->db_name, $this->dbconn );
  29. }
  30. }
  31. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.