Advertisement
Guest User

Untitled

a guest
Sep 6th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. error: SQLSTATE[HY000] [2002] No such file or directory
  2. Error al conectar a la base de datos. SQLSTATE[HY000] [2002] No such file or
  3. directory
  4.  
  5. <?php
  6. $DB_host="localhost";
  7. $DB_user="root";
  8. $DB_pass="pass";
  9. $DB_name="aviwebco_supera_tu_crisis";
  10.  
  11. try {
  12.  
  13. $DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}", $DB_user,$DB_pass);
  14. $DB_con->exec("SET CHARACTER SET utf8");
  15. $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  16.  
  17. } catch (PDOException $e) {
  18.  
  19. print "¡Error!: " . $e->getMessage() . "<br/>";
  20. echo "Error al conectar a la base de datos. " . $e->getMessage() . "<br/>";
  21. }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement