Guest User

Untitled

a guest
Jan 12th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. $db_connection = pg_connect("host=localhost dbname=levantiu_levantium user=levantiu_levantium_app password=mypassword");
  2.  
  3. $dsn = "pgsql:host=localhost;dbname=levantiu_levantium";
  4. $options = [
  5. PDO::ATTR_EMULATE_PREPARES => false, // turn off emulation mode for "real" prepared statements
  6. PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, //turn on errors in the form of exceptions
  7. PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, //make the default fetch be an associative array
  8. ];
  9. try {
  10. $pdo = new PDO($dsn, "levantiu_levantium_app", "mypassword", $options);
  11. echo 'conectado!';
  12. } catch (Exception $e) {
  13. var_dump($e->getMessage());
  14. exit('Something weird happened'); //something a user can understand
  15. }
Add Comment
Please, Sign In to add comment