summaryrefslogtreecommitdiffstats
path: root/Db.class.php
diff options
context:
space:
mode:
authorIndieteq <admin@indieteq.com>2013-11-10 18:06:26 +0100
committerIndieteq <admin@indieteq.com>2013-11-10 18:06:26 +0100
commitcfa2fe3ed39a315f5dc33fce582d64d4854f6a9c (patch)
tree1d56f014f3405b00acec8bdb2c0a3111a0b91ef6 /Db.class.php
parentf7f0436cc993cf9980d2eafdc91d95b0223d1374 (diff)
downloadphp-mysql-pdo-database-class-cfa2fe3ed39a315f5dc33fce582d64d4854f6a9c.zip
php-mysql-pdo-database-class-cfa2fe3ed39a315f5dc33fce582d64d4854f6a9c.tar.gz
php-mysql-pdo-database-class-cfa2fe3ed39a315f5dc33fce582d64d4854f6a9c.tar.bz2
Added lastinsertId method
And fixed the sql writing to log.
Diffstat (limited to 'Db.class.php')
-rw-r--r--Db.class.php15
1 files 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
+?>