example:
<?php
// select all fields from salay table
$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();
}
/* output
* Array ( [0] => ID [1] => USERID [2] => VALUE )
*/
?>