From cfa2fe3ed39a315f5dc33fce582d64d4854f6a9c Mon Sep 17 00:00:00 2001 From: Indieteq Date: Sun, 10 Nov 2013 18:06:26 +0100 Subject: Added lastinsertId method And fixed the sql writing to log. --- Db.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Db.class.php b/Db.class.php index 6be4c94..813de24 100644 --- a/Db.class.php +++ b/Db.class.php @@ -111,7 +111,7 @@ class DB catch(PDOException $e) { # Write into log and display Exception - echo $this->ExceptionLog($e->getMessage(),$this->sQuery->queryString); + echo $this->ExceptionLog($e->getMessage(), $query ); die(); } @@ -169,7 +169,16 @@ class DB else { return NULL; } - } + } + + /** + * Returns the last inserted id. + * @return string + */ + public function lastInsertId() { + return $this->pdo->lastInsertId(); + } + /** * Returns an array which represents a column from the result set * @@ -239,4 +248,4 @@ class DB return $exception; } } -?> \ No newline at end of file +?> -- cgit v1.1