fix support group bug and dblayer bug

This commit is contained in:
botanic 2014-09-03 04:42:28 -07:00
parent f7d338bdf6
commit 9855aecc25
3 changed files with 4 additions and 4 deletions

View file

@ -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)");

View file

@ -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");
}
/*

View file

@ -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////////////////////////////////////////////////////