# 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()](/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" %}


---

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