<?php
try {
$dbh = new PDO('pgsql:host=localhost;port=5432;dbname=###;user=###;password=##');
echo "PDO connection object created";
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
I get the error message "Could Not Load Driver"
Try this:
Uncomment the following in php.ini by removing the ";"
;extension=php_pgsql.dll
Use the following code to connect to a postgresql database server:
pg_connect("host=localhost dbname=dbname user=username password=password")
or die("Can't connect to database".pg_last_error());