Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Chatter elimination



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group