pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul M Foster <paulf@quillandmouse.com>
To: pgsql-php@postgresql.org
Subject: Chatter elimination
Date: Wed, 29 Mar 2006 23:09:29 -0500
Message-ID: <442B59F9.7030505@quillandmouse.com> (raw)

I have a php file called "coldstart.php" which is supposed to check if a 
  database exists, and if not create it, and create the tables 
associated with it. It attempts a pg_connect() with the database name 
and other parameters. The first time it's run, this call returns false, 
because the database doesn't exist. At that point, I connect to the 
template1 database and create my target database, etc. After this, I 
redirect to a different PHP script, using the header() directive.

This process works fine, insofar as it creates the database and tables. 
However, when the first pg_connect() is called with the name of the 
non-existent database, PostgreSQL/PHP dumps the following error message:

Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
database "webcust" does not exist in /var/www/qmsi/webcust/db.php on line 39

Well and good. Except that when the script gets down to the header() 
call (after creating the database and tables), it has a problem, because 
headers have already been sent, in the form of the aforementioned error 
message. So it barfs right there.

So the question is: Is it possible to shut off this "chatter" that 
PostgreSQL/PHP puts out when an error such as this occurs?

-- 
Paul M. Foster



view thread (2+ messages)  latest in thread

Message-ID: <442B59F9.7030505@quillandmouse.com>
Permalink:  ../442B59F9.7030505@quillandmouse.com/
Also on:    postgresql.org/message-id/442B59F9.7030505@quillandmouse.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: paulf@quillandmouse.com
  Subject: Re: Chatter elimination
  In-Reply-To: <442B59F9.7030505@quillandmouse.com>
  References: <442B59F9.7030505@quillandmouse.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox