PHP 函数:pg_Fetch_Row()

返回单列的各字段。

语法: array pg_fetch_row(int result, int row);

返回值: 数组

函数种类: 数据库功能

内容说明
本函数用来将查询结果 result 之单列拆到数组变量中。数组的索引是数字索引,第一个的索引值是 0。若 result 没有资料,则返回 false 值。参数 row 表列数。

使用范例

<?php $conn = pg_pconnect("","","","","publisher"); if (!$conn) { echo "连接失败\n"; exit; } $result = pg_Exec($conn, "SELECT * FROM authors"); if (!$result) { echo "查询失败\n"; exit; } $row = pg_fetch_row($result, 0); echo $row[0] . " <- row\n"; $row = pg_fetch_row($result, 1); echo $row[0] . " <- row\n"; $row = pg_fetch_row($result, 2); echo $row[1] . " <- row\n"; ?>