Re: GetRows equivalent?
| From: | Soeren Staun-Pedersen | Date: | Wed, 26 Jul 2000 16:47:35 +0000 |
| Subject: | Re: GetRows equivalent? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8341@lists.php.net to get a copy of this message | ||
> Is there anything in PHP db drivers that could be considered
> the equivalent of GetRows from the ASP/ODBC world? In a nutshell,
> rather than looping thru a result set one row at a time, you
> can 'GetRows' and the entire result set will be returned as an
> array that you can loop thru locally, rather than continually
> pulling from the DB driver.
As far as I know there isn't. I don't know if it is considered harmful,
but I would. The result set you get from a, e.g. mysql_query(), call is
gathered in one fell swoop. It is not gathered bit by bit from the server
everytime you read a row from it.
Doing what you suggest would mean moving one large datastructure into
another large datastructure.. that cannot be a speed improvement.
You can go an awful long way with this little construct:
$query = mysql_query("some sql");
while($row = mysql_fetch_array($query)
{
echo $row["some_column"];
echo $row["some_other_column"];
}
Cheers,
Soeren Staun-Pedersen - staun@netwarriors.org
------
"The internet is full, beat it"
- Me.