Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('HOST','localhost');
- define('DB_NAME','pdo');
- define('USER','eduardo');
- define('PASS','php_data_objects');
- $dsn = 'mysql:host='.HOST.';dbname='.DB_NAME;
- try {
- $bd = new PDO($dsn,USER,PASS);
- $bd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
- } catch (PDOException $e) {
- echo htmlentities('Houve algum erro com a conexão com o banco de dados: '. $e->getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement