Guest User

Untitled

a guest
May 1st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Database
  2. {
  3. private static $datasource = 'mysql:host=localhost; dbname=mydbname';
  4. private static $username = 'root';
  5. private static $password = 'root';
  6. private static $pdo;
  7.  
  8. public static function getPDO()
  9. {
  10. if (!isset(self::$db)) {
  11. self::$pdo = new PDO(self::$datasource, self::$username, self::$password);
  12. }
  13. return self::$pdo;
  14. }
  15. }
Add Comment
Please, Sign In to add comment