I have 3 mysql queries that I execute from php, 1 is successful and 2 are not. I have however set a commit and rollback. When I do a var_dump on the the commit it returns true,
If you tell it to commit it will commit. It won't roll back just because there was an error in one of the statements. You have to check for errors each time you perform a query and then rollback if there is an error. Or just check at the end before committing:
public function commit() {
$mysqli=$this->db_connection;
if ($this->error['State'] === 0) {
$this->setError("Error: Please try again");
mysqli_rollback($mysqli);
} else {
$c = mysqli_commit($mysqli);
if ($c) return 1;
}
}
The issue was that the tables were isam and the database was innoDB. When I changed the tables to innoDB it started working.