From 56ae4ac94b1775bb58c63b5ed83bead4369dcdd1 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 26 Oct 2009 14:34:37 +0200 Subject: Changes --- Db.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Db.php') diff --git a/Db.php b/Db.php index 2ce5ff0..c98d1cb 100644 --- a/Db.php +++ b/Db.php @@ -90,7 +90,14 @@ class Db $data['id'] = self::getInstance()->lastInsertId(); } - return $data; + // Always strip ":" prefixes from input array keys + $out = array(); + foreach ($data as $k => $v) { + $key = ltrim($k, ':'); + $out[$key] = $v; + } + + return $out; } -- cgit v1.2.3 From b69995e1d0bcd5ea1185acfda4899e11f1d8e624 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 26 Oct 2009 15:19:28 +0200 Subject: Some fixes --- Db.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Db.php') diff --git a/Db.php b/Db.php index e90362f..2b66fbe 100644 --- a/Db.php +++ b/Db.php @@ -66,19 +66,20 @@ class Db } try { - + $stmt = self::getInstance()->prepare($sql); $result = $stmt->execute($data); if (!$result) { - $e = $stmt->errorInfo(); - exit(App::error($e[2])); + $e = $pdo->errorInfo(); + $error = $e[2] ."\n" . print_r(debug_backtrace(), true); + return App::error($error); } } catch (PDOException $e) { $error = $e->getMessage() . $sql; - App::log($error); - exit(App::error($error)); + $error .= "\n" . print_r(debug_backtrace(), true); + return App::error($error); } // Select statements need the query results @@ -90,8 +91,8 @@ class Db $data['id'] = self::getInstance()->lastInsertId(); } - // Always strip ":" prefixes from input array keys $out = array(); + // Always strip ":" prefixes from input array keys foreach ($data as $k => $v) { $key = ltrim($k, ':'); $out[$key] = $v; -- cgit v1.2.3