An example of a script to connect to a postgreSQL database:
For correct functionality of the database connection must be in stringu in the specification of the database server used:
"< name-database dbaserver.net >."
If you are using to log on to the database IP address, you must edit it according to the above example, as in the case of migration of the database on a different server connection to the database is no longer work.
<?php
$link = pg_connect("host=<název-databáze>.dbaserver.net port=5432 dbname=nazev_databaze user=nazev_uzivatele password=heslo")
or die ("Nepripojeno : " . pg_last_error($link));
echo "Pripojeno";
// .....další příkazy a dotazy na databázi
pg_close($link);
?>