I have a strange behavior in a php script (PHP 8.1) using MariaDB 10.7.5 database.

This one with native SQL works:

[ ... some database stuff ... ]

But using PDO's own function does not work, it results to "PHP Fatal error: Uncaught PDOException: There is no active transaction in xxxx":

[ ... some database stuff ... ]

Can someone explain me why?

  • 1
    Were there any DDL statements in the 'stuff'?
    – Rick James
    Sep 23, 2022 at 19:06
  • 1
    Or any other statement that causes an implicit commit? Sep 23, 2022 at 21:58
  • By the way, I edited your question and tags to make it clear that you are using MariaDB, not MySQL. These are different products, not compatible. You shouldn't think of them as variants of the same product. Sep 23, 2022 at 21:59
  • @RickJames no statements like this... only some select, updates and inserts... it still works when i use "BEGIN" and "COMMIT", but not when I use the PDO built-In functions.
    – Marco
    Sep 26, 2022 at 14:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.