Re: large resultset

From: Thom Brown <thombrown(at)gmail(dot)com>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: large resultset
Date: 2010-06-15 09:33:05
Message-ID: AANLkTimP7qSASY3dRA09p6e35CzRLo8pOyZ6J5_5Bisx@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On 15 June 2010 09:31, AI Rumman <rummandba(at)gmail(dot)com> wrote:

> How to return large resutlset (almost 2 millions record) in php?
>

Presumably this is so people can download results rather than display them
in a browser?

Here's a basic a raw version of what you can do:

$db = pg_connect($connection_string);

$results = pg_query($db, $query);

while ($result = pg_fetch_array($results)
{
echo implode("|", $result) . "\n";
}

pg_close($db);

Obviously that wouldn't do by itself, but it's quite simple to loop over a
result set.

Regards

Thom

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message vinny 2010-06-15 09:40:11 Re: large resultset
Previous Message AI Rumman 2010-06-15 08:31:32 large resultset