> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_field_count.md).

# mysql\_field\_count

## Syntax

```c
unsigned int mysql_field_count(MYSQL * mysql);
```

## Parameter

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md) or [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md).

## Description

Returns the number of columns for the most recent query on the connection represented by the link parameter as an unsigned integer. This function can be useful when using the [mysql\_store\_result()](/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result.md) function to determine if the query should have produced a non-empty result set or not without knowing the nature of the query.

## Return Value

The number of columns for the most recent statement. The value is zero, if the statement didn't produce a result set.

{% hint style="info" %}
The mysql\_field\_count() function should be used to determine if there is a result set available.
{% endhint %}

## See Also

* [mysql\_store\_result()](/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result.md)
* [mysql\_use\_result()](/docs/connectors/mariadb-connector-c/api-functions/mysql_use_result.md)

{% @marketo/form formId="4316" %}
