Advertisement
Guest User

Untitled

a guest
Dec 18th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. class db{
  3. // Properties
  4. private $dbhost = 'localhost';
  5. private $dbuser = 'root';
  6. private $dbpass = '******';
  7. private $dbname = 'slimapp';
  8.  
  9. // connection
  10. public function connect(){
  11. $mysql_connect_str = "mysql:host=$this->dbhost;dbname=$this->dbname;";
  12. $dbConnection = new PDO($mysql_connect_str, $this->dbuser, $this->dbpass);
  13. $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  14. return $dbConnection;
  15. }
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement