conn = null; try { $this->conn = new PDO('mysql:host='.$this->db_hostname.';dbname='.$this->db_database, $this->db_username, $this->db_password); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $ex) { die("Hubo un error. No se pudo conectar a la base de datos: ".$ex->getMessage()); } return $this->conn; } } ?>