ASWADI

config

Mar 13th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2. class config{
  3.  
  4.     private $host = "localhost";
  5.     private $user = "root";
  6.     private $pass = "";
  7.     private $dbnm = "smartschool";
  8.     private $dbms = "mysql";
  9.     public $conn;
  10.  
  11.     public function getConnection(){
  12.         $this->conn = null;
  13.         try{
  14.             $this->conn = new PDO($this->dbms.":host=".$this->host.";dbname=".$this->dbnm,$this->user,$this->pass);
  15.         } catch(PDOException $exception){
  16.             echo "Koneksi Error... ".$exception->getMessage();
  17.         }
  18.         return $this->conn;
  19.     }
  20.  
  21. }
  22. ?>
Add Comment
Please, Sign In to add comment