# mysql\_commit

## Syntax

```c
my_bool mysql_commit(MYSQL * mysql);
```

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_init) or [mysql\_real\_connect()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect).

## Description

Commits the current transaction for the specified database connection. Returns zero on success, nonzero if an error occurred.

{% hint style="info" %}
Executing mysql\_commit() will not affected the behaviour of [autocommit](https://app.gitbook.com/s/SsmexDFPv2xG2OTyO5yV/server-management/variables-and-modes/server-system-variables#autocommit). This means, any update or insert statements following mysql\_commit() will be rolled back when the connection gets closed.
{% endhint %}

## See also

* [mysql\_rollback()](https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_rollback)

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