PDO

From GLMWiki
Jump to: navigation, search
$dbh = new PDO(
  'pgsql: host=localhost dbname=demo user=nobody',
  null,
  null,
  array(
       PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
  )
);
$dbh->setAttribute(
    PDO::ATTR_ERRMODE,
    PDO::ERRMODE_EXCEPTION
);
$dbh->query("SET DATESTYLE TO 'SQL, US'");