Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - <?php
 - class Database
 - {
 - private $host="localhost";
 - private $username="root";
 - private $password="";
 - private $db_name="works";
 - public $connect;
 - public function dbConnection()
 - {
 - $this->connect=null;
 - try
 - {
 - $this->connect=new PDO("mysql:host=".$this->host.";dbname=".$this->db_name,$this->username,$this->password);
 - $this->connect->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
 - $this->connect->exec("SET CHARACTER SET `utf8`");
 - }catch(PDOException $error)
 - {
 - print_r($error->getMessage());
 - }
 - return $this->connect;
 - }
 - }
 - ?>
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment