# 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" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_field_count.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
