aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche')
-rw-r--r--inc/poche/Database.class.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 4d664992..0662581b 100644
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -113,9 +113,17 @@ class Database {
113 } 113 }
114 114
115 public function updateUserConfig($userId, $key, $value) { 115 public function updateUserConfig($userId, $key, $value) {
116 $sql_update = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; 116 $config = $this->getConfigUser($userId);
117 $params_update = array($value, $userId, $key); 117
118 $query = $this->executeQuery($sql_update, $params_update); 118 if (!isset ($user_config[$key])) {
119 $sql = "INSERT INTO users_config (`value`, `user_id`, `name`) VALUES (?, ?, ?)";
120 }
121 else {
122 $sql = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?";
123 }
124
125 $params = array($value, $userId, $key);
126 $query = $this->executeQuery($sql, $params);
119 } 127 }
120 128
121 private function executeQuery($sql, $params) { 129 private function executeQuery($sql, $params) {