示例
<?php
// 从 salay 表中选择所有字段
$sql = "SELECT * FROM SALARY";
$stmt = db2_prepare($conn,$sql);
if(db2_execute($stmt)){
$columns = db2_num_fields($stmt);
for($i=0;$i<$columns;$i++){
$fieldName[] = db2_field_name($stmt,$i);
}
print_r($fieldName);
}else{
echo db2_stmt_errormsg();
}
/* 输出
* Array ( [0] => ID [1] => USERID [2] => VALUE )
*/
?>