pg_put_line() Frustration - Mailing list pgsql-php

From Simon Hewitt
Subject pg_put_line() Frustration
Date
Msg-id BAY103-F2DAC914A1FB677D5AFCC1D5E90@phx.gbl
Whole thread Raw
Responses Re: pg_put_line() Frustration
Re: pg_put_line() Frustration
List pgsql-php
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



pgsql-php by date:

Previous
From: Felipe Fernandez
Date:
Subject: Problemas con 7.4.7 y php 4-10 debian3.1
Next
From: Michael Fuhr
Date:
Subject: Re: pg_put_line() Frustration