I have three sql queries in a try/catch block. Autocommit is off and all three queries run without errors, I have verified that (it shouldn't reach the commit line if any query fails, but I've verified it via xdebug, stepping through the code one line at a time). When the code reached the commit() function call, mysqli returns false, but no error message. How can a commit fail when the previous queries all worked?
This is basically how the code looks:
try{
$mysqli->autocommit(false);
$sql1 = "insert into...";
$mysqli->query($sql); // Works!
if($mysqli->error)
{
$mysqli->rollback();
throw new Exception....
}
$sql2 = "insert into...";
$mysqli->query($sql); // Works!
if($mysqli->error)
{
$mysqli->rollback();
throw new Exception....
}
$mysqli->commit(); // Fail
}