Name

mysql_fetch_field_direct( )

Synopsis

MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, 
                                      unsigned int field_nbr)

This returns a MYSQL_FIELD structure that provides information on a given field of a results set referred to in the first argument of the function. The particular field is given as the second argument.

...
MYSQL_FIELD *field;
...
mysql_query(mysql, "SELECT * FROM clients LIMIT 1");
result =  mysql_store_result(mysql);
field =  mysql_fetch_field_direct(result, 0);
printf("%s \n", field->name);
...

This function is similar to mysql_fetch_field( ) except that information on just one specified field can be obtained. In the example here, the name of the first field (0 being the first) will be displayed.

Get MySQL in a Nutshell 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.