From 9855aecc2575773f50b2dd101f1bc4703b1639f8 Mon Sep 17 00:00:00 2001 From: botanic Date: Wed, 3 Sep 2014 04:42:28 -0700 Subject: [PATCH] fix support group bug and dblayer bug --- code/web/private_php/ams/autoload/dblayer.php | 2 +- code/web/private_php/ams/autoload/in_support_group.php | 4 ++-- code/web/private_php/ams/autoload/support_group.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/web/private_php/ams/autoload/dblayer.php b/code/web/private_php/ams/autoload/dblayer.php index 0df7d75b7..1f361008b 100644 --- a/code/web/private_php/ams/autoload/dblayer.php +++ b/code/web/private_php/ams/autoload/dblayer.php @@ -223,7 +223,7 @@ class DBLayer { */ public function insert($tb_name, $data, $datafunc = array()) { $this->useDb(); - $field_options = implode(',', array_merge(array_keys($data), array_keys($datafunc))); + $field_options = '`'.implode('`,`', array_merge(array_keys($data), array_keys($datafunc))).'`'; $field_values = implode(',', array_merge(array(':' . implode(',:', array_keys($data))), array_values($datafunc))); try { $sth = $this->PDO->prepare("INSERT INTO $tb_name ($field_options) VALUE ($field_values)"); diff --git a/code/web/private_php/ams/autoload/in_support_group.php b/code/web/private_php/ams/autoload/in_support_group.php index 86c678cd3..73d075168 100644 --- a/code/web/private_php/ams/autoload/in_support_group.php +++ b/code/web/private_php/ams/autoload/in_support_group.php @@ -54,7 +54,7 @@ class In_Support_Group{ */ public function create() { $dbl = new DBLayer("lib"); - $dbl->insert("`in_support_group`", Array('User' => $this->user, 'Group' => $this->group); + $dbl->insert("`in_support_group`", Array('User' => $this->user, 'Group' => $this->group)); } @@ -64,7 +64,7 @@ class In_Support_Group{ */ public function delete() { $dbl = new DBLayer("lib"); - $dbl->delete("`in_support_group`", array('user_id' => $this->getUser() ,'group_id' => $this->getGroup(), "`User` = :user_id and `Group` = :group_id"); + $dbl->delete("`in_support_group`", array('user_id' => $this->getUser() ,'group_id' => $this->getGroup()), "`User` = :user_id and `Group` = :group_id"); } /* diff --git a/code/web/private_php/ams/autoload/support_group.php b/code/web/private_php/ams/autoload/support_group.php index d482a842f..880c7b338 100644 --- a/code/web/private_php/ams/autoload/support_group.php +++ b/code/web/private_php/ams/autoload/support_group.php @@ -337,7 +337,7 @@ class Support_Group{ */ public function delete(){ $dbl = new DBLayer("lib"); - $dbl->delete("`support_group`", Array('id' => $this->getSGroupId(), "`SGroupId` = :id")); + $dbl->delete("`support_group`", Array('id' => $this->getSGroupId()), "`SGroupId` = :id"); } ////////////////////////////////////////////Getters////////////////////////////////////////////////////