Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.     class Database{
  3.         public static $connection;
  4.  
  5.         private static $dbtype = "mysql";
  6.         private static $dbname = "crud_php";
  7.         private static $host = "localhost";
  8.         private static $user = "root";
  9.         private static $pass = "";
  10.  
  11.         public function getconnection(){
  12.             if(!self::$connection){
  13.                 self::$connection = new PDO("$dbase:db_name=$dbname;host=$host", $user, $pass);
  14.             }
  15.             return self::$connection;
  16.         }
  17.  
  18.     }
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement