pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedSQL query to a file
3+ messages / 2 participants
[nested] [flat]
* SQL query to a file
@ 2002-07-01 12:41 Marcelo Pereira <gandalf@sum.desktop.com.br>
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Pereira @ 2002-07-01 12:41 UTC (permalink / raw)
To: pgsql-php; php-pt@yahoogrupos.com.br
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?
Thanks in advance,
Marcelo Pereira
-- Remember that only God and Esc+:w saves.
__
(_.\ Marcelo Pereira |
/ / ___ |
/ (_/ _ \__ Matematica/99 - IMECC |
_______\____/_\___)___Unicamp_______________/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SQL query to a file
@ 2002-07-01 12:58 dan radom <dan@radom.org>
parent: Marcelo Pereira <gandalf@sum.desktop.com.br>
0 siblings, 1 reply; 3+ messages in thread
From: dan radom @ 2002-07-01 12:58 UTC (permalink / raw)
To: pgsql-php
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?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SQL query to a file
@ 2002-07-01 13:27 Marcelo Pereira <gandalf@sum.desktop.com.br>
parent: dan radom <dan@radom.org>
0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Pereira @ 2002-07-01 13:27 UTC (permalink / raw)
To: dan radom <dan@radom.org>; +Cc: pgsql-php
Hi Dan,
Thanks for you answer!!
I will look for touch and fopen!!
Regards,
Marcelo Pereira
-- Remember that only God and Esc+:w saves.
__
(_.\ Marcelo Pereira |
/ / ___ |
/ (_/ _ \__ Matematica/99 - IMECC |
_______\____/_\___)___Unicamp_______________/
--- dan radom, with your fast fingers, wrote:
:> 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?
:>
:>
:>
:> ---------------------------(end of broadcast)---------------------------
:> TIP 4: Don't 'kill -9' the postmaster
:>
:>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-07-01 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-01 12:41 SQL query to a file Marcelo Pereira <gandalf@sum.desktop.com.br>
2002-07-01 12:58 ` dan radom <dan@radom.org>
2002-07-01 13:27 ` Marcelo Pereira <gandalf@sum.desktop.com.br>
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