我遇到了一个问题:
以下是代码:
/* connection */
$gaSql['user'] = $dbuname;
$gaSql['password'] = $dbpass;
$gaSql['db'] = $dbname;
$gaSql['server'] = $dbhost;
$gaSql['link'] = pg_connect(
" host=".$gaSql['server'].
" dbname=".$gaSql['db'].
" user=".$gaSql['user'].
" password=".$gaSql['password']
) or die('Could not connect: ' . pg_last_error());
/* query */
$sQuery = "SELECT * FROM person";
$rResult = pg_query( $gaSql['link'], $sQuery ) or die(pg_last_error());
$iTotal = pg_num_rows($rResult);
while ( $aRow = pg_fetch_array($rResult, null, PGSQL_ASSOC) ) {
//do something...
}
我的问题是:
假设表person
共有10行。变量$iTotal
返回了正确的行数:10。但是,当我尝试使用pg_fetch_array
获取它时,它无法获取(它没有输入{{ 1}}操作)。
这种情况有什么问题?拜托,有人可以帮助我吗?
非常感谢你。