Is it necessary to rollback if commit fails?
问题 This seems like a simple enough question, yet I couldn't find any definitive answers specific for MySQL. Look at this: $mysqli->autocommit(false); //Start the transaction $success = true; /* do a bunch of inserts here, which will be rolled back and set $success to false if they fail */ if ($success) { if ($mysqli->commit()) { /* display success message, possibly redirect to another page */ } else { /* display error message */ $mysqli->rollback(); //<----------- Do I need this? } } $mysqli-