クエリを実行するいくつかのメソッドで beginTransaction を使用しています。ただし、クエリが失敗してもクエリを実行します。私の問題がどこにあるのか誰か知っていますか?
基本を示すためだけに、コードを乾かします。
方法:
public function __construct() 
    {
        $this->core = db_core::getInstance();
    }
function handle_item($action, $item_id) 
    {
        switch($action) {
        case 'add':
            $this->core->conn->query("INSERT INTO ....");
            break;
        case 'remove':
            $this->core->conn->query("DELETE FROM ....");
            break;
        }
    }
beginTransaction
try 
    {
    $this->core->conn->beginTransaction();
    $this->handle_item("remove", $item_id);
    $this->handle_item("add", $item_id);
    $this->core->conn->commit();
    catch (PDOException $e) 
    {
    $this->core->conn->rollBack();
    echo $e->getMessage();
    }