From c00cbb7985f4bcc8703564770b960ed5ba40ab21 Mon Sep 17 00:00:00 2001 From: Lillem4n Date: Thu, 24 Nov 2011 16:11:03 +0100 Subject: [PATCH] Fixed bug in transaction load data --- classes/model/transaction.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/model/transaction.php b/classes/model/transaction.php index 44701b7..eb0b73e 100644 --- a/classes/model/transaction.php +++ b/classes/model/transaction.php @@ -20,9 +20,10 @@ public function __construct($id = NULL, $data = NULL) } elseif ($id > 0) { + $id = (int) preg_replace("/[^0-9]+/", '', $id); if ($this->load_entry_data($id)) { - $this->id = preg_replace("/[^0-9]+/", '', $id); + $this->id = $id; } } } @@ -122,7 +123,7 @@ public function get_id() private function load_entry_data($id) { - return ($this->data = $this->pdo->query('SELECT * FROM transactions WHERE id = ?', $id)->fetch(PDO::FETCH_ASSOC)); + return ($this->data = $this->pdo->query('SELECT * FROM transactions WHERE id = '.$id)->fetch(PDO::FETCH_ASSOC)); } }