note 35486 added to function.pg-fetch-all
| From: | Julietwll20 at yahoo dot com | Date: | Tue, 02 Sep 2003 19:25:21 +0000 |
| Subject: | note 35486 added to function.pg-fetch-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55492@lists.php.net to get a copy of this message | ||
if (! function_exists("pg_fetch_all")) {
function pg_fetch_all($res, $kind="assoc") {
$i = 0; // this is needed for the row integer in the looped pg_fetch_array
if ($kind == "assoc") {
while ($row = pg_fetch_array($res, $i, PGSQL_ASSOC)) {
$array_out[] = $row;
$i++;
}else{
while ($row = pg_fetch_array($res)) {
$array_out[] = $row;
}
}
return $array_out;
}
}
tasmanian at devil dot com
27-Mar-2003 08:42
It seems like pg_fetch_all() only works on version 4.3.x. I tried it with 4.2.2 and it does not
recognize the function, so I assume it won't work on 4 => 4.2.x.
jcomeau at whatisthewww dot com
19-Feb-2003 10:02
pg_fetch_all, despite the app note, accepts only one argument, the resultset. It does exactly what
is expected, returning a two-dimensional array of the resultset. I suspect the app note given was
just copied from pg_fetch_array, which is what you want to use for a single row.
----
Manual Page -- http://www.php.net/manual/en/function.pg-fetch-all.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35486
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35486&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35486&report=yes