mysqli_commit

(PHP 5 CVS only)

mysqli_commit

(no version information, might be only in CVS)

mysqli->commit -- Commits the current transaction

Description

Procedural style:

bool mysqli_commit ( object link)

Object oriented style (method)

class mysqli {

bool commit ( void )

}

Commits the current transaction for the database specified by the link parameter.

Return values

Zwraca TRUE w przypadku sukcesu, FALSE w przypadku porażki.

See also

mysqli_autocommit(), mysqli_rollback().

Examples

Przykład 1. Object oriented style

<?php

$mysqli
= new mysqli("localhost", "my_user", "my_password", "test");

$mysqli->query("DROP TABLE IF EXISTS ta_sample");
$mysqli->query("CREATE TABLE ta_sample (a int) TYPE=InnoDB");

/* set autocommit to off */
$mysqli->autocommit(FALSE);

/* Insert some values */
$mysqli->query("INSERT INTO ta_sample VALUES (1)");
$mysqli->query("INSERT INTO ta_sample VALUES (1)");

/* commit transaction */
$mysqli->commit();

/* close connection */
$mysqli->close();
?>

Przykład 2. Procedural style

<?php

$link
= mysqli_connect("localhost", "my_user", "my_password", "test");

mysqli_query($link, "DROP TABLE IF EXISTS ta_sample");
mysqli_query($link, "CREATE TABLE ta_sample (a int) TYPE=InnoDB");

/* set autocommit to off */
mysqli_autocommit($link, FALSE);

/* Insert some values */
mysqli_query($link, "INSERT INTO ta_sample VALUES (1)");
mysqli_query($link, "INSERT INTO ta_sample VALUES (1)");

/* commit transaction */
mysqli_commit($link);

/* close connection */
mysqli_close($link);
?>