•
mysqli::commit
mysqli_commit
Commits the current transaction
Description
Object oriented style
bool mysqli::commit();
Procedural style
bool mysqli_commit(
mysqli link);
Commits the current transaction for the database connection.
Parameters
link
Return Values
Returns
on success or
TRUE
Examples
Example 20.112.
mysqli::commit
Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE Language LIKE CountryLanguage");
/* set autocommit to off */
$mysqli->autocommit(FALSE);
/* Insert some values */
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)");
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
/* commit transaction */
$mysqli->commit();
/* drop table */
$mysqli->query("DROP TABLE Language");
/* close connection */
$mysqli->close();
?>
Procedural style
MySQL Improved Extension (Mysqli)
Procedural style only: A link identifier returned by
mysqli_connect
on failure.
FALSE
example
2359
or
mysqli_init
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers