# 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()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_init).
* `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()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare). Returns zero on success, non-zero on failure.

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

## See Also

* [mariadb\_stmt\_execute\_direct()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mariadb_stmt_execute_direct)
* [mysql\_stmt\_prepare()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_prepare)
* [mysql\_stmt\_bind\_result()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_bind_result)
* [mysql\_stmt\_execute()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_execute)
* [mysql\_stmt\_param\_count()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_param_count)
* [mysql\_stmt\_send\_long\_data()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_send_long_data)

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