X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6240211F6298 for ; Thu, 30 Mar 2006 00:09:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11842-02 for ; Thu, 30 Mar 2006 00:09:35 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 95F5A11F6273 for ; Thu, 30 Mar 2006 00:09:34 -0400 (AST) Received: from haylee.gendns10.com (haylee.gendns10.com [216.180.234.5]) by svr4.postgresql.org (Postfix) with ESMTP id 12B7E5AF939 for ; Thu, 30 Mar 2006 04:09:33 +0000 (GMT) Received: from pool-71-98-166-169.tampfl.dsl-w.verizon.net ([71.98.166.169] helo=sherman.mars.lan) by haylee.gendns10.com with esmtp (Exim 4.52) id 1FOoTU-0002aB-I0 for pgsql-php@postgresql.org; Wed, 29 Mar 2006 23:09:32 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by sherman.mars.lan (Postfix) with ESMTP id 03D4456D9E for ; Wed, 29 Mar 2006 23:09:30 -0500 (EST) Message-ID: <442B59F9.7030505@quillandmouse.com> Date: Wed, 29 Mar 2006 23:09:29 -0500 From: Paul M Foster Reply-To: paulf@quillandmouse.com User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Chatter elimination Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - haylee.gendns10.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - quillandmouse.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200603/19 X-Sequence-Number: 3469 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