# mysql\_field\_count

## Syntax

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

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

## 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()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result) function to determine if the query should have produced a non-empty result set or not without knowing the nature of the query.

{% 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()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_store_result)
* [mysql\_use\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_use_result)

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