Bit short on comments and tips bout this one so head down to mysql_fetch_fields where the concept is the same. I seemed to get an infinite loop over there using the $i counter tho, so I used a for loop instead.
The list of properties you can get from what I've called $info is in the example to the mysql equivalent.
//start of an example to print out column headings
echo "<table><tr>";
$numfields=sybase_num_fields($query);
for ($f=0;$f<=$numfields;$f++){
$info = sybase_fetch_field($query);
echo "<td> $info->name </td>";
}
echo "</tr><tr>";
sybase_fetch_field
(PHP 4, PHP 5)
sybase_fetch_field — 데이타 셋의 필드 정보를 얻는다.
Description
object sybase_fetch_field
( int $result
[, int $
field_offset
] )
field 값에 대한 정보를 가진 객체를 반환한다.
sybase_fetch_field() 함수는 특정 쿼리 결과값에서 필드에 정보를 얻는데 사용되어 진다. 만약 field_offet값이 정해지지 않으면 이전 sybase_fetch_field()함수에 의해 얻어진 필드의 다음 필드가 반환된다.
정보 객체의 내부 속성값들은 다음과 같다.
- name - 이름 컬럼이다, 만약 컬럼이 함수의 결과값이면 이 속성은 계산된 #N값이고 이 #N은 serial number 이다.
- column_source - 컬럼 값을 가져온 대상 table
- max_length - 컬럼의 최대길이
- numeric - 만약 컬럼이 숫자값이면 1을 가진다.
- type - 컬럼의 datatype
See also sybase_field_seek()
sybase_fetch_field
anthony dot leung at virgin dot net
25-Jun-2003 11:44
25-Jun-2003 11:44
gray at voicenet dot com
15-Oct-1999 03:27
15-Oct-1999 03:27
The 'type' field contains (roughly) the datatype of the source column. Types returned are:
'type' Sybase Type
------- --------------------------
string CHAR, VARCHAR, TEXT
image IMAGE
blob BINARY, VARBINARY
bit BIT
int TINYINT, SMALLINT, INT
real REAL, FLOAT, NUMERIC, DECIMAL
money MONEY
datetime DATETIME, SMALLDATETIME
