---
name: "mysql_stmt_execute"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_stmt_execute"
---

# mysql\_stmt\_execute(3)

### Name

mysql\_stmt\_execute - Executes a prepared statement

### Synopsis

-

  ```
  #include <mysql.h>
  int mysql_stmt_execute(MYSQL_STMT * stmt);
  ```

### Description

Executes a prepared statement which was previously prepared by **[mysql\_stmt\_prepare(3)](/mysql_stmt_prepare/3.md)**. When executed any parameter markers which exist will automatically be replaced with the appropriate data.

### Parameter

- •

  `stmt` - A statement handle, which was previously allocated by **[mysql\_stmt\_init(3)](/mysql_stmt_init/3.md)**.

### Return value

Returns zero on success, non-zero on failure.

### Notes

- •

  If the statement is UPDATE, REPLACE, DELETE or INSERT, the total number of affected rows can be determined by using the **[mysql\_stmt\_affected\_rows(3)](/mysql_stmt_affected_rows/3.md)** function. Likewise, if the query yields a result set the **[mysql\_stmt\_fetch(3)](/mysql_stmt_fetch/3.md)** function is used.

### See Also

- •

  **[mariadb\_stmt\_execute\_direct(3)](/mariadb_stmt_execute_direct/3.md)**

- •

  **[mysql\_stmt\_prepare(3)](/mysql_stmt_prepare/3.md)**

- •

  **[mysql\_stmt\_bind\_param(3)](/mysql_stmt_bind_param/3.md)**
