(PHP 4 >= 4.3.0, PHP 5, PHP 7)
pg_fetch_assoc — ��ȡһ����Ϊ��������
$result
[, int $row
] ) : arraypg_fetch_assoc() �͵��� pg_fetch_array() ���ϵ�������ѡ���� PGSQL_ASSOC �ǵȼ۵ġ���ֻ����һ���������顣�����Ҫ������������ pg_fetch_row()��
pg_fetch_assoc() �� pg_fetch_row() ����չ�汾�����˽����ݴ洢�������������ֶα�ţ�֮�⣬Ĭ�ϻ�������洢�ڹ����������ֶ������С�
row
��Ҫ����ȡ���У���¼����š���һ��Ϊ 0��
pg_fetch_assoc() �������Ա� pg_fetch_row() �������һ�����������ʹ�á�
Example #1 pg_fetch_assoc() ����
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
$result = pg_query($conn, "SELECT id, author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
}
while ($row = pg_fetch_assoc($result)) {
echo $row['id'];
echo $row['author'];
echo $row['email'];
}
?>
�μ� pg_fetch_row()��pg_fetch_array()��pg_fetch_object() �� pg_fetch_result()��