Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Database {
- public function __construct() {
- /*** hostname ***/
- $hostname = $config['db']['host'];
- /*** dbname ***/
- $dbname = $config['db']['dbname'];
- /*** username ***/
- $username = $config['db']['username'];
- /*** password ***/
- $password = $config['db']['password'];
- function dbcon ($hostname, $username, $password){
- $dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }
- try {
- $dbh = dbcon ($hostname, $username, $password);
- print 'je hebt connectie';
- } catch(PDOException $e) {
- echo $e->getMessage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement