Re: warning message to hide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Alain Roger <raf.news@xxxxxxxxx>:

> Hi,
> 
> Today i discovered that when my host webserver has some issue with
> PostgreSQL database, my code displays the following error message :
> *"Warning*: pg_connect()
> [function.pg-connect<http://www.immense.sk/function.pg-connect>]:
> Unable to connect to PostgreSQL server: could not connect to server:
> Connection refused Is the server running on host "pgsql.exohosting.sk" and
> accepting TCP/IP connections on port 5432? in */www/xxxx.php* on line yyy."
> 
> I would like instead of that, to display my own error message... in fact, i
> would like to display something like : "We are sorry but temporary we have
> some technical issues. Please try again later".
> how can i do that ?
> 
> i tried to do :
> $conn = pg_connect($conn_string);


try putting an @ sign before this line. something like this:
@$conn = pg_connect($conn_string);

that should do the job for you in this case.

Siavash


> 
> if ($conn) // check if database is online
> {
>     // close database connection
>     pg_close($conn);
> }
> else
> {
>     // impossible to connect to DB
>     die('Maintenance in progress... Try later.');
> }
> 
> but it still display the previous warning message.
> thanks for your help.
> 
> 
> -- 
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.1.4
> Apache 2.0.58
> PHP 5
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux