Re: large resultset

Thom Brown <[email protected]> Tue, 15 Jun 2010 10:33:05 +0100
Newsgroups gmane.comp.db.postgresql.php
Message-ID <[email protected]>
On 15 June 2010 09:31, AI Rumman <[email protected]> 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