pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dan radom <dan@radom.org>
To: pgsql-php@postgresql.org
Subject: Re: SQL query to a file
Date: Mon, 1 Jul 2002 06:58:20 -0600
Message-ID: <20020701125820.GT25268@lunar.radom.org> (raw)
In-Reply-To: <Pine.LNX.4.20.0207010937240.657-100000@ni.hmmg.sp.gov.br>
References: <Pine.LNX.4.20.0207010937240.657-100000@ni.hmmg.sp.gov.br>

you can use the PHP touch and fopen functions and then write the rows to the file using a for loop.

dan

* Marcelo Pereira (gandalf@sum.desktop.com.br) wrote:
> Hi All,
> 
> I have a connection to a PostgreSQL database, and I would to write a query
> result to a file.
> 
> Example:
> # ----8<----------------------------------------------
> $conection = pgconnect(...
> $sql = "select * from mytable";
> $result = pg_exec($conection, $sql);
> # -----8<---------------------------------------------
> 
> So, the results are stored in $result, how can I write this to a file?





view thread (3+ messages)  latest in thread

Message-ID: <20020701125820.GT25268@lunar.radom.org>
Permalink:  ../20020701125820.GT25268@lunar.radom.org/
Also on:    postgresql.org/message-id/20020701125820.GT25268@lunar.radom.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: dan@radom.org
  Subject: Re: SQL query to a file
  In-Reply-To: <20020701125820.GT25268@lunar.radom.org>
  References: <Pine.LNX.4.20.0207010937240.657-100000@ni.hmmg.sp.gov.br> <20020701125820.GT25268@lunar.radom.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox