Descripción
string
mysql_field_type
( int id_resultado, int offset_del_campo)
mysql_field_type(
)
es
similar
a
la
función
mysql_field_name(
)
.
Los
argumentos
son
identicos
,
pero
se
devuelve
el
tipo
de
campo
.
El
tipo
sera
"
int"
,
"real"
,
"string"
,
"blob
"
,
o
otros
detallados
en
la
documentación
de
MySQL
.
Ejemplo
1
.
mysql
field
types
?php
mysql_connect(
"localhost:3306")
;
mysql_select_db("wisconsin")
;
$result
=
mysql_query("SELECT
*
FROM
onek")
;
$fields
=
mysql_num_fields($result)
;
$rows
=
mysql_num_rows($result)
;
$i
=
0
;
$table
=
mysql_field_table($result
,
$i)
;
echo
"Your
'".$table
."
'
table
has
".$fields
.
"
fields
and
".$rows
.
"
records
BR
"
;
echo
"The
table
has
the
following
fields
BR
"
;
while
($i
$fields
)
{
$type
=
mysql_field_type
($result
,
$i)
;
$name
=
mysql_field_name
($result
,
$i)
;
$len
=
mysql_field_len
($result
,
$i)
;
$flags
=
mysql_field_flags
($result
,
$i)
;
echo
$type
.
"
".$name
.
"
".$len
.
"
".$flags
.
"
BR
"
;
$i++
;
}
mysql_close()
;
?
|
|
Por
razones
de
compatibilidad
puede
usarse
tambien
mysql_fieldtype(
)
.