PHP + PostgreSQL データの取り出し

PHP + PostgreSQL データの取り出し

while( $one = pg_fetch_assoc($res) ){
	$user[$one["id"]] = $one["name"];
}
for( $i=0; $i<pg_num_rows($res); $i++ ){
        $id        = pg_fetch_result( $res, $i, "id" );
	$user[$id] = pg_fetch_result( $res, $i, "name" );
}
$row = pg_fetch_row($res);
$user_id = $row[0];