string
$spec = "1"])Fetch rows from the cursor. See pq\Cursor::move().
FETCH and MOVE usually accepts arguments like the following, where count
is the number of rows:
count
count
count
count
count
See the official PostgreSQL documentation for details.
<?php
$c = new pq\Connection;
$p = new pq\Cursor($c, "mycursor", pq\Cursor::WITH_HOLD,
"SELECT * FROM generate_series(0,29) s WHERE (s%2)=0");
for ($r = $p->fetch(2); $r->numRows; $p->move(1), $r = $p->fetch(2)) {
foreach ($r as $row) {
foreach ($row as $col) {
echo " $col";
}
echo "\n";
}
}
?>
Yields:
0
2
6
8
12
14
18
20
24
26