SHARE
TWEET

Tutorial City

a guest Feb 11th, 2010 4,045 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. define('HOST','localhost');
  4. define('DB_NAME','pdo');
  5. define('USER','eduardo');
  6. define('PASS','php_data_objects');
  7.  
  8. $dsn = 'mysql:host='.HOST.';dbname='.DB_NAME;
  9.  
  10. try {
  11.         $bd = new PDO($dsn,USER,PASS); 
  12.         $bd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
  13. } catch (PDOException $e) {
  14.         echo htmlentities('Houve algum erro com a conexão com o banco de dados: '. $e->getMessage());
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top