Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function getDB()
- {
- static $db = null;
- if ($db === null) {
- $host = 'localhost';
- $dbname = 'php_framework';
- $username = 'root';
- $password = '';
- try {
- $connection = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
- return $connection;
- } catch (PDOException $e) {
- echo $e->getMessage();
- }
- }
- }
Add Comment
Please, Sign In to add comment