Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $db_connection = pg_connect("host=localhost dbname=levantiu_levantium user=levantiu_levantium_app password=mypassword");
- $dsn = "pgsql:host=localhost;dbname=levantiu_levantium";
- $options = [
- PDO::ATTR_EMULATE_PREPARES => false, // turn off emulation mode for "real" prepared statements
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, //turn on errors in the form of exceptions
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, //make the default fetch be an associative array
- ];
- try {
- $pdo = new PDO($dsn, "levantiu_levantium_app", "mypassword", $options);
- echo 'conectado!';
- } catch (Exception $e) {
- var_dump($e->getMessage());
- exit('Something weird happened'); //something a user can understand
- }
Add Comment
Please, Sign In to add comment