Created
August 30, 2012 00:05
-
-
Save clarkeash/3520745 to your computer and use it in GitHub Desktop.
Database Class - PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Database { | |
public static $conn; | |
public static function connect(){ | |
try { | |
$conn = new PDO(DB_DRIVER.':host='.DB_HOST.';dbname='.DB_NAME.';', DB_USER, DB_PASSWORD); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
self::$conn = $conn; | |
} catch (PDOException $e) { | |
$e->getMessage(); | |
} | |
} | |
} | |
//Construct | |
Database::connect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment