Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Connection {
- public $host = 'localhost';
- public $dbname = 'usodecontas';
- public $username = 'root';
- public $password = 'abc123';
- public function conectar() {
- try {
- $conn = new PDO("mysql:host={$this->host};dbname={$this->dbname}", $this->username, $this->password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $conn;
- } catch (PDOException $e) {
- echo $e->getMessage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement