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 0534C11F65EB for ; Thu, 30 Mar 2006 00:25:11 -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 16137-01 for ; Thu, 30 Mar 2006 00:25:08 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.203]) by postgresql.org (Postfix) with ESMTP id E3A5611F6A9F for ; Thu, 30 Mar 2006 00:25:04 -0400 (AST) Received: by uproxy.gmail.com with SMTP id c2so179159ugf for ; Wed, 29 Mar 2006 20:25:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Qi8E2SVijXvgi9Er45YB98jSGGyAmiIvxDJ6vFBgahd3vrEZLHNaRyrkeiHGTOAH5SOgTMewF7CH6xjXHc9nz1y4OfumWl9QB3r3bunvFA5W2DKQ1AtfbDoss3u+UsKSaeOgffVWeTXZyhL86syHwJVlYzxpB580wBeRpttC3Ug= Received: by 10.78.21.7 with SMTP id 7mr43838huu; Wed, 29 Mar 2006 20:25:01 -0800 (PST) Received: by 10.78.46.8 with HTTP; Wed, 29 Mar 2006 20:25:01 -0800 (PST) Message-ID: <219837f70603292025n1d7781abi3934ece7f8cf7cb5@mail.gmail.com> Date: Wed, 29 Mar 2006 21:25:01 -0700 From: "Sam Sutch" To: paulf@quillandmouse.com Subject: Re: Chatter elimination Cc: pgsql-php@postgresql.org In-Reply-To: <442B59F9.7030505@quillandmouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <442B59F9.7030505@quillandmouse.com> 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/20 X-Sequence-Number: 3470 Suppress the errors of the expression using the @ error suppression operato= r. For example: @pg_connect(/*your details*/); Will suppress the errors for that expression. You can use it like this too $connection =3D @pg_connect(/*your details*/); You can also use this at the top of your script: error_reporting(0); // see php.net/error_reporting -Sam (shit, sorry, forgot to reply to all) On 3/29/06, Paul M Foster wrote: > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >