aboutsummaryrefslogtreecommitdiffstats
path: root/Controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'Controller.php')
-rw-r--r--Controller.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/Controller.php b/Controller.php
index e25c575..432ae93 100644
--- a/Controller.php
+++ b/Controller.php
@@ -216,7 +216,7 @@ class Controller
* Insert this thing in the DB and return inserted
* thing
*/
- public function insert()
+ public function insert($data)
{
if (empty($data)) {
return App::error("Nothing to insert");
@@ -249,9 +249,10 @@ class Controller
}
list($key, $value) = each($where);
+ $data = array(":{$key}" => $value);
+ $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key}";
- $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = ?";
- return Db::query($sql, array($value));
+ return Db::query($sql, $data);
}
@@ -260,7 +261,7 @@ class Controller
* We keep this in the Controller since it might know
* more about the topmost class
*/
- public function update($data, $where = null)
+ protected function update($data, $where = null)
{
if (!is_array($data)) {
return App::error("Update with empty parameters");