mysql_field_type(result,offset)

Description: Returns the type of a specified field in a result.

After calling mysql_list_fields(), mysql_query(), or another function that returns a resource identifier given by result, mysql_field_name() returns the type of a given field indexed by offset, being one of int, string, real, blob, and so on.

Example:

$result = mysql_list_fields ("cms", "subscribers");
$name = mysql_field_type ($result, 2);  // offset of 2 means the third column
echo "$name<BR>\n";

See also: mysql_field_flags(), mysql_field_len(), mysql_field_name(), mysql_list_fields()

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.