Re: [PHP] warning message to hide



Short-term, you can toss an @ in front of pg_eonnect.

Long-term:
http://php.net/set_error_handler
Also check out ini_set for error_log and friends.

After you've done it the Right Way, get rid of the @

On Sat, April 14, 2007 8:44 am, Alain Roger wrote:
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);

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



--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: Unknown characters showing on form?
    ... get me some screen shots of the system info so i can see what version of Jet ... The problem is on all of the computers on this particular server, ... service pack for there version of Office *and* for the JET database engine. ... I dont have remote access to actually see what the display problems are, ...
    (microsoft.public.access.forms)
  • Re: Advice needed for a proposal
    ... I wrote a similar app for a client. ... "server" program that collected, stored and displayed data, and a "client" app ... in an Advantage database. ... display of values by polling the connected unit at user-configurable time periods. ...
    (borland.public.delphi.non-technical)
  • Re: Access and Postgresql
    ... end on the same machine that is hosting the Postgresql program. ... If you have a split Access database with back-end (tables, data, and ... relationships) on the server, and the front-end (queries, forms, reports, ... the fact is they are _hoping_ that it is some other software interfering ...
    (comp.databases.ms-access)
  • Re: Python Database Apps
    ... make an app that has a local DB and a server side DB. ... It maybe overkill for a client side database. ... The psycopg package makes interfacing to PostgreSQL very easy and there is a package for Linux and Windows to make cross-platform development a breeze. ... If an app comes already designed for mysql, oracle, sqlite, db2, dbm, ...
    (comp.lang.python)
  • Re: Re: help choosing OLAP solutions that run on/with pgsql
    ... > for MSTR ... > Application server if need be. ... > and the underlying database itself. ... > Using a combination of PostGreSQL for the warehouse and Jasper ...
    (comp.databases.olap)