Advertisement
ryvan

pdo connection

Oct 2nd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2. // Para abrir una conexión con el servidor de base de datos
  3. $dsn = 'mysql:host=localhost;dbname=personalblog;charset=utf8';
  4. $user = 'michael';
  5. $password = 'jackson';
  6. try{
  7.   $pdo = new PDO($dsn, $user, $password);
  8. } catch(PDOException $e) {
  9.   echo $e->getMessage();
  10. }
  11.  
  12. // Para cerrar la conexión
  13. $pdo = null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement