MySQL Forums
Forum List  »  PHP

[with database.php LIBRARY pdo usage from mysql i think] the below I got above error
Posted by: Leonidas Savvides
Date: May 02, 2014 08:12AM

Fatal error: Uncaught exception 'PDOException' with message 'There is no active transaction' in C:\xampp\htdocs\VPS\PphCHnew\php\database.php:108 Stack trace: #0 C:\xampp\htdocs\VPS\PphCHnew\php\database.php(108): PDO->rollBack() #1 C:\xampp\htdocs\VPS\PphCHnew\paypal\noPayPal2.php(253): Database->cancelTransaction() #2 C:\xampp\htdocs\VPS\PphCHnew\a4-review-book-confirm.php(2): require_once('C:\xampp\htdocs...') #3 {main} thrown inC:\xampp\htdocs\VPS\PphCHnew\php\database.php on line 108

Whenever I use [with database.php LIBRARY pdo usage from mysql i think] the below I got above error? What must use commit/cancel with database.php library?

mycode.php
try {
$database = new Database();

$database->beginTransaction();
.………….
…………..
$database->endTransaction();
} catch (PDOException $e) {
$database->cancelTransaction();
//echo "Something went wrong: " . $e->getMessage();
} catch (Exception $e) {
$database->cancelTransaction();
//echo "Something went wrong: " . $e->getMessage();
}

database.php
public function cancelTransaction(){
return $this->dbh->rollBack(); // line 108
}

Options: ReplyQuote


Subject
Written By
Posted
[with database.php LIBRARY pdo usage from mysql i think] the below I got above error
May 02, 2014 08:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.