fix support group bug and dblayer bug

hg/feature/cdb-packed
botanic 10 years ago
parent f7d338bdf6
commit 9855aecc25

@ -223,7 +223,7 @@ class DBLayer {
*/ */
public function insert($tb_name, $data, $datafunc = array()) { public function insert($tb_name, $data, $datafunc = array()) {
$this->useDb(); $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))); $field_values = implode(',', array_merge(array(':' . implode(',:', array_keys($data))), array_values($datafunc)));
try { try {
$sth = $this->PDO->prepare("INSERT INTO $tb_name ($field_options) VALUE ($field_values)"); $sth = $this->PDO->prepare("INSERT INTO $tb_name ($field_options) VALUE ($field_values)");

@ -54,7 +54,7 @@ class In_Support_Group{
*/ */
public function create() { public function create() {
$dbl = new DBLayer("lib"); $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() { public function delete() {
$dbl = new DBLayer("lib"); $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");
} }
/* /*

@ -337,7 +337,7 @@ class Support_Group{
*/ */
public function delete(){ public function delete(){
$dbl = new DBLayer("lib"); $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//////////////////////////////////////////////////// ////////////////////////////////////////////Getters////////////////////////////////////////////////////

Loading…
Cancel
Save