X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7A9CA5282E for ; Mon, 20 Jun 2005 11:05:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49836-10 for ; Mon, 20 Jun 2005 14:05:34 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 1DCB65290B for ; Mon, 20 Jun 2005 11:05:33 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5KE5WMK074167 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Jun 2005 08:05:34 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5KE5VpX026209; Mon, 20 Jun 2005 08:05:31 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5KE5V38026208; Mon, 20 Jun 2005 08:05:31 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 20 Jun 2005 08:05:31 -0600 From: Michael Fuhr To: simon.hewitt@greenhill-ymca.org Cc: pgsql-php@postgresql.org Subject: Re: pg_put_line() Frustration Message-ID: <20050620140531.GA26064@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/16 X-Sequence-Number: 3175 On Mon, Jun 20, 2005 at 01:29:47PM +0000, Simon Hewitt wrote: > > I am currently working on an application that will input multple lines into > a Postgre database. I am using the following code It's PostgreSQL or Postgres, not Postgre. > $sql = "COPY table_2 FROM STDIN DELIMITER AS '\t'"; > pg_query($dbc, $sql); > $sql = $data1."\t".$data2."\t".implode("\t", > $data)."\ttrue\t05-05-2005\n"; > pg_put_line($this->dbc, $sql); > if(!pg_put_line($dbc, "\\N")) The last line above attempts to add a row with a single NULL value, so you get an error about missing data for the other columns. What's the purpose of that line? Why do you sometimes use $dbc and sometimes $this->dbc? Do they refer to the same connection or to different connections? -- Michael Fuhr http://www.fuhr.org/~mfuhr/