// Initialize connection object $conn = mysqli_connect('localhost', 'username', 'password', 'database_name'); // Enable autocommit mode mysqli_autocommit($conn, true);
// Initialize connection object $conn = mysqli_connect('localhost', 'username', 'password', 'database_name'); // Disable autocommit mode mysqli_autocommit($conn, false); // Execute queries mysqli_query($conn, "INSERT INTO table_name (column1, column2) VALUES ('value1', 'value2')"); mysqli_query($conn, "UPDATE table_name SET column1='new_value' WHERE column2='value2'"); // Commit changes mysqli_commit($conn);
// Initialize connection object $conn = mysqli_connect('localhost', 'username', 'password', 'database_name'); // Disable autocommit mode mysqli_autocommit($conn, false); // Execute queries mysqli_query($conn, "INSERT INTO table_name (column1, column2) VALUES ('value1', 'value2')"); mysqli_query($conn, "UPDATE table_name SET column1='new_value' WHERE column2='value2'"); // Rollback changes mysqli_rollback($conn);The mysqli autocommit function is a part of the PHP mysqli extension library.