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)); } }