the code below is a transaction where 2 inserts are made as part of the user registration procedure:
$connection->autocommit(FALSE);
$result1 =$connection->query("insert into users values (NULL,'" .$name. "','" .$lastname . "','".$email."','". $passwd."','". $hash."','4')");
$result2=$connection->query("insert into business_users values('".$connection->insert_id."','".$address."' , '".$url ."','".$phone. "','".$city. "','".$municipality. "','".$buztype. "')");
if(!$result1||!$result2)
{$connection->rollback();
$connection->autocommit(TRUE);
return false;
}else
{$connection->autocommit(TRUE);
}
As you see if the transaction fails false is returned. Nonetheless, if there is a failure in the user registration process I need to have more info regarding that failure.
Returning false, I do not think is enough…what to do…use exception?