Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is a constructor that will return a handle to deal with a connection to the database MySQL
- public function __construct() {
- $this->dsn = "xxxxxxxx";
- $this->username = "xxxxxxx";
- $this->password = "xxxxx";
- $this->db = "xxxxx";
- try {
- $this->conn = new PDO("mysql:host=$this->dsn; dbname=$this->db", $this->username, $this->password);
- $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- }// End of try
- catch(PDOException $e){
- echo $e->getMessage();
- $this->conn = null;
- die();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement