I have this PHP code:

$dbconn = @pg_connect("host=$this->host port=$this->port user=$this->username password=$this->password") or die(pg_last_error());
I use an invalid password because I want to see the pg_last_error output. But a problem appear:

Warning: pg_last_error() [function.pg-last-error]: No PostgreSQL link opened yet in D:\wamp\www\myscript\includes\class.database.inc on line 42
Why this error message appear ? I need a message from pg_last_error, something like: password is wrong.

Any idea how to solve this issue ? Thanks!