Documentation Home
MySQL 8.0 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.2Mb
PDF (A4) - 1.2Mb
HTML Download (TGZ) - 159.0Kb
HTML Download (Zip) - 190.2Kb

11.4 mysql_stmt_bind_param()

mysql_stmt_bind_param(MYSQL_STMT *stmt,
                      MYSQL_BIND *bind)


mysql_stmt_bind_param() is used to bind input data for the parameter markers in the SQL statement that was passed to mysql_stmt_prepare(). It uses MYSQL_BIND structures to supply the data. bind is the address of an array of MYSQL_BIND structures. The client library expects the array to contain one element for each ? parameter marker that is present in the query.

Suppose that you prepare the following statement:


When you bind the parameters, the array of MYSQL_BIND structures must contain three elements, and can be declared like this:

MYSQL_BIND bind[3];

For a description of the members of the MYSQL_BIND structure and how they should be set to provide input values, see Chapter 9, C API Prepared Statement Data Structures.

Return Values

Zero for success. Nonzero if an error occurred.



See the Example in Section 11.10, “mysql_stmt_execute()”.