Esempio n. 1
0
 public function _deleteOne($table, $id)
 {
     $backup = new modelBackupRestore();
     $content = $backup->_backupData($id, $name, $table);
     $backup->_webLog($name, 'delete', $table, $_SESSION['adminUser'], $content, $_SESSION['adminLang']);
     $sql = "DELETE FROM `{$table}` WHERE `id`='{$id}' LIMIT 1";
     $this->db->query($sql);
     return true;
 }
Esempio n. 2
0
 public function _getSql($type, $table, $fields, $values, $id = NULL)
 {
     $backup = new modelBackupRestore();
     if ($type == 1) {
         $content = '';
         $action = 'create';
         $sql = $this->_create($table, $fields, $values);
     } elseif ($type == 2 && is_numeric($id)) {
         $content = $backup->_backupData($id, $name, $table);
         $action = 'update';
         $sql = $this->_update($table, $fields, $values, $id);
     } else {
         return FALSE;
     }
     if (!$this->db->query($sql)) {
         die($this->db->error);
         return FALSE;
     } else {
         if ($type == 1) {
             $id = $this->db->insert_id;
             $backup->_backupData($id, $name, $table);
         }
         $backup->_webLog($name, $action, $table, $_SESSION['adminUser'], $content, $_SESSION['adminLang']);
         return TRUE;
     }
 }