Autocommit with PDO

Viewed 7950

The rollback of my transaction doesn't work. How do I set autocommit to false (or 0) in the php script using PDO (I have InnoDB 5.7.18) ?

Here is my code:

     global $bdd;  //defined with PDO

       try {                             
            $bdd->beginTransaction();
            /* my requests */
            $bdd->commit();
        } catch (Exception $e) {
            $bdd->rollBack();
            return $e->getMessage();
        }

        return true;
    }
3 Answers
Related