# mysql\_stmt\_field\_count

## Syntax

```c
unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt);
```

* `stmt` - a statement handle, which was previously allocated by [mysql\_stmt\_init()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_init).

## Description

Returns the number of fields in a result set of a prepared statement.

{% hint style="info" %}
The number of fields will be available after calling [mysql\_stmt\_prepare()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare)

`mysql_stmt_field_count()` returns zero for `UPSERT` statements which don't produce a result set.
{% endhint %}

## See Also

* [mysql\_stmt\_prepare()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare)
* [mysql\_stmt\_param\_count()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_param_count)

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