# mysql\_stmt\_bind\_result

## Syntax

```c
my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt,
                               MYSQL_BIND * bind);
```

* `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).
* `bind` - an array of [MYSQL\_BIND](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/connector-c-data-structures-and-definitions/mysql_bind) structures. The size of this array must be equal to the number of columns in result set.

## Description

Binds columns in the result set to variables. Returns zero on success, non-zero on failure.

{% hint style="info" %}
To determine the number of columns in result set use [mysql\_stmt\_field\_count()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_field_count).

A column can be bound or rebound at any time, even after a result set has been partially retrieved. The new binding takes effect the next time [mysql\_stmt\_fetch()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch) is called.
{% endhint %}

## See Also

* [mysql\_stmt\_field\_count()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_field_count)
* [mysql\_stmt\_execute()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_execute)
* [mysql\_stmt\_fetch()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch)

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