Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 80C99475C24 for ; Mon, 1 Jul 2002 08:58:18 -0400 (EDT) Mailbox-Line: From dan@radom.org Mon Jul 1 08:58:18 2002 Received: from lunar.radom.org (12-253-20-188.client.attbi.com [12.253.20.188]) by postgresql.org (Postfix) with ESMTP id 5B070475C22 for ; Mon, 1 Jul 2002 08:58:17 -0400 (EDT) Received: (from graffix@localhost) by lunar.radom.org (8.11.6/8.11.6) id g61CwK422744 for pgsql-php@postgresql.org; Mon, 1 Jul 2002 06:58:20 -0600 X-Authentication-Warning: lunar.radom.org: graffix set sender to dan@radom.org using -f Date: Mon, 1 Jul 2002 06:58:20 -0600 From: dan radom To: pgsql-php@postgresql.org Subject: Re: SQL query to a file Message-ID: <20020701125820.GT25268@lunar.radom.org> Reply-To: "dan@radom.org" Mail-Followup-To: pgsql-php@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Spam-Status: No, hits=-4.1 required=5.0 tests=IN_REP_TO,X_AUTH_WARNING version=2.30 X-Spam-Level: X-Archive-Number: 200207/4 X-Sequence-Number: 1306 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?