我正在使用PHP和MySQL来调用几个命令。 有一个组 - 员工交叉引用表，可以在组中添加或删除员工。 我正在编写此功能，首先删除所有员工，然后在组中的每个员工中添加回来（如果组已修改）。 但我想确保所有命令都通过或者让表回滚。 如何确保命令以原子方式发生？ p> div>
I'm using PHP and MySQL to call a couple of commands. There is a group-employee cross-reference table, and employees may be added or removed from the group. I'm writing this feature by first removing all the employees and then adding back in each employee that is in the table if the group is modified. But I want to make sure that all the commands go through or else have the table roll back. How can I make sure the commands happen atomically?