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 B0CF9528B7 for ; Mon, 20 Jun 2005 11:36:05 -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 56407-09 for ; Mon, 20 Jun 2005 14:35:54 +0000 (GMT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id 69A555287D for ; Mon, 20 Jun 2005 11:35:53 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id A374C119F64; Mon, 20 Jun 2005 22:35:56 +0800 (WST) Received: from vscan02.westnet.com.au ([127.0.0.1]) by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05512-04; Mon, 20 Jun 2005 22:35:56 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan02.westnet.com.au (Postfix) with ESMTP id 31A54119F10; Mon, 20 Jun 2005 22:35:56 +0800 (WST) Message-ID: <42B6D450.50106@familyhealth.com.au> Date: Mon, 20 Jun 2005 22:36:00 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: simon.hewitt@greenhill-ymca.org Cc: pgsql-php@postgresql.org Subject: Re: pg_put_line() Frustration References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/17 X-Sequence-Number: 3176 Use pg_copy_to and pg_copy_from instead... Chris Simon Hewitt wrote: > Hi all, > > I am currently working on an application that will input multple lines > into a Postgre database. I am using the following code > > $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")) > { > pg_end_copy($dbc); > $error_message('Could not enter details'); > } > else > { > pg_end_copy($this->dbc); > unset($data); > } > > This gives me an example line like > > 57 BELF 254 0 10877 5138 0 0 true 05-05-2005 > > To go into a table with fields INT, CHAR(4) INT, INT, INT, INT, INT, > INT, BOOL, DATE > > However, its not going in... > > I'm getting an error > > ERROR: missing data for column "col2" > > With no data being inserted. > > If anyone could point out where I'm going wrong I'd be forever in their > debt > > Thanks > > Simon > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org