pg_fetch_row,從偏移量 0 開始,返回提取一行數據。
基本介紹
pg_fetch_row,說明,pg_fetch_row() 例子,注,
pg_fetch_row
(PHP 3>= 3.0.1, PHP 4 )
pg_fetch_row -- 提取一行作為枚舉數組
說明
array pg_fetch_row ( resource result, int row)
返回的數組和提取的行相一致。如果沒有更多行可提取,則返回 FALSE。
pg_fetch_row() 例子
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT * FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
}
while ($row = pg_fetch_row($result, $i)) {
for ($j=0; $j < count($row); $j++) {
echo $row[$j] . " ";
}
echo "<br />\n";
}
?>
注
從 4.1.0 開始,row 成為可選參數。每次調用 pg_fetch_row(),內部的行計數器都會加一。