diff --git a/reference/pgsql/functions/pg-fetch-row.xml b/reference/pgsql/functions/pg-fetch-row.xml index 74b9134e73..3906f4828f 100644 --- a/reference/pgsql/functions/pg-fetch-row.xml +++ b/reference/pgsql/functions/pg-fetch-row.xml @@ -1,5 +1,5 @@ - + @@ -48,13 +48,9 @@ if (!$result) { exit; } -$num = pg_num_rows($result); - -for ($i=0; $i < $num; $i++) { - $r = pg_fetch_row($result, $i); - - for ($j=0; $j < count($r); $j++) { - echo "$r[$j] "; +while ($row = pg_fetch_row($result, $i)) { + for ($j=0; $j < count($row); $j++) { + echo "$row[$j] "; } echo "
";