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 — obtiene la información del campo
Descripción
object sybase_fetch_field
( int $result
[, int $field_offset
] )
Devuelve un objeto conteniendo la información del campo
sybase_fetch_field() puede usarse para obtener información sobre los campos de una consulta determinada. Si no se específica el offset del campo, el siguiente campo que aún no halla sido tomado por sybase_fetch_field() es el que se obtiene.
Las propiedades del objeto son:
- name - nombre de la columna. si la columna es el resultado de una función, esta propiedad se establece a computed#N, donde #N es un número de serie.
- column_source - la tabla de la cual se tomo la columna
- max_length - máxima longitud de la columna
- numeric - 1 si la columna es numérica
Vea también sybase_field_seek().
sybase_fetch_field
anthony dot leung at virgin dot net
25-Jun-2003 06:44
25-Jun-2003 06:44
gray at voicenet dot com
15-Oct-1999 10:27
15-Oct-1999 10: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
