PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<pg_fetch_resultpg_field_is_null>
Last updated: Mon, 16 Jul 2012

pg_fetch_row

(PHP 3 >= 3.0.1, PHP 4, PHP 5)

pg_fetch_row -- 提取一行作为枚举数组

说明

array pg_fetch_row ( resource result, int row )

pg_fetch_row() 根据指定的 result 资源提取一行数据(记录)作为数组返回。每个得到的列依次存放在数组中,从偏移量 0 开始。

返回的数组和提取的行相一致。如果没有更多行可提取,则返回 FALSE

例子 1. 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] . "&nbsp;";
  }

  echo
"<br />\n";

}
?>

注: 从 4.1.0 开始,row 成为可选参数。每次调用 pg_fetch_row(),内部的行计数器都会加一。

参见 pg_query()pg_fetch_array()pg_fetch_object()pg_fetch_result()




<pg_fetch_resultpg_field_is_null>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST