PHP PDO Connection


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. try {
  2. $db = new PDO("pgsql:dbname=dbname;host=localhost", "username", "password" );
  3. echo "Database connection established.\n";
  4. $db = null;
  5. }
  6. catch(PDOException $e){
  7. echo $e->getMessage();
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.