Skip site navigation (1) Skip section navigation (2)

Re: pg_put_line() Frustration

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: simon(dot)hewitt(at)greenhill-ymca(dot)org
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: pg_put_line() Frustration
Date: 2005-06-20 14:05:31
Message-ID: 20050620140531.GA26064@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-php
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/

In response to

pgsql-php by date

Next:From: Christopher Kings-LynneDate: 2005-06-20 14:36:00
Subject: Re: pg_put_line() Frustration
Previous:From: Simon HewittDate: 2005-06-20 13:29:47
Subject: pg_put_line() Frustration

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group