# mysql\_stmt\_bind\_param

## Syntax

```c
my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt,
                              MYSQL_BIND * bnd);
```

* `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 structures. The size of this array must be equal to the number of parameters.

## Description

Binds variables for parameter markers in the prepared statement that was passed to [mysql\_stmt\_prepare()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare.md). Returns zero on success, non-zero on failure.

* The number of parameters can be obtained by [mysql\_stmt\_param\_count()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_param_count.md).
* If the number of parameters is unknown, for example when using [mariadb\_stmt\_execute\_direct()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mariadb_stmt_execute_direct.md), the number of parameters have to be specified with the [mysql\_stmt\_attr\_set()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_attr_set.md) function.

## See Also

* [mariadb\_stmt\_execute\_direct()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mariadb_stmt_execute_direct.md)
* [mysql\_stmt\_prepare()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare.md)
* [mysql\_stmt\_bind\_result()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_bind_result.md)
* [mysql\_stmt\_execute()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_execute.md)
* [mysql\_stmt\_param\_count()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_param_count.md)
* [mysql\_stmt\_send\_long\_data()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_send_long_data.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_param.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.
