我的问题是,我有一个数据库设计,来自这个链接is my database overdesigned?
编辑* 好的,也许使用事务?但如果失败了,我应该在哪里放置回滚?
$dbConnect->beginTransaction();
$RegisterInsert = $dbConnect->prepare("INSERT INTO companies (
`name`, `address`, `email`, `phone`, `link`, `verified`) VALUES (
:name, :address, :email, :phone, :link, :verified)");
$RegisterInsert->execute($RegisterData);
$RegisterData2['CID'] = $dbConnect->lastInsertId();
$RegisterInsert = $dbConnect->prepare("INSERT INTO users_companies (
`UID`, `CID`, `role`) VALUES (
:UID, :CID, :role)");
$RegisterInsert->execute($RegisterData2);
$dbConnect->commit();
我应该把回滚放在哪里?
谢谢