aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mekanisti.fi>2009-10-28 21:30:39 +0200
committerFilipp Lepalaan <filipp@mekanisti.fi>2009-10-28 21:30:39 +0200
commit4a7a8168743588ac37b81fbfe5e27677a67749ce (patch)
tree3dccd792563762fbf4579e2570491d9e39dee3e1
parent78112fa3ee94f7f29f842f82fac992c9e6bd236f (diff)
downloadmain-4a7a8168743588ac37b81fbfe5e27677a67749ce.tar.gz
main-4a7a8168743588ac37b81fbfe5e27677a67749ce.tar.bz2
main-4a7a8168743588ac37b81fbfe5e27677a67749ce.zip
Commit
-rw-r--r--App.php1
-rw-r--r--Controller.php9
2 files changed, 6 insertions, 4 deletions
diff --git a/App.php b/App.php
index bacabbf..42f8b4c 100644
--- a/App.php
+++ b/App.php
@@ -142,6 +142,7 @@ class App
$fh = fopen($file, "a+");
fwrite($fh, "$msg\n");
fclose($fh);
+
}
/**
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");