> 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-prepared-statement-functions/mysql_stmt_bind_result.md).

# mysql\_stmt\_bind\_result

## Syntax

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

## Parameters

* `stmt` - a statement handle, which was previously allocated by [mysql\_stmt\_init()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_init.md).
* `bind` - an array of [MYSQL\_BIND](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/connector-c-data-structures-and-definitions/mysql_bind.md) 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()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_field_count.md).

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()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch.md) is called.
{% endhint %}

## See Also

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

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