PHP mysqli_rollback() Function

Object oriented style

bool mysqli::rollback ([ int $flags [, string $name ]] )

Procedural style

bool mysqli_rollback ( mysqli $link [, int $flags [, string $name ]] )

Rollbacks the current transaction for the database.The mysqli_rollback() function rolls back the current transaction for the specified database connection.

Examples -

Object oriented style

Procedural style

The above examples will output:

0 rows in table myCity. 50 rows in table myCity (after rollback).

ParameterDescription
linkProcedural style only: A link identifier returned by mysqli_connect() or mysqli_init()
flagsA bitmask of MYSQLI_TRANS_COR_* constants.
nameIf provided then ROLLBACK/*name*/ is executed.

Returns TRUE on success or FALSE on failure.