diff options
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r-- | include/functions.inc.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 015eb8849..7012db248 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1022,19 +1022,33 @@ SELECT param, value function conf_update_param($param, $value) { $query = ' -DELETE +SELECT + param, + value FROM '.CONFIG_TABLE.' WHERE param = \''.$param.'\' ;'; - pwg_query($query); + $params = array_from_query($query, 'param'); - $query = ' + if (count($params) == 0) + { + $query = ' INSERT INTO '.CONFIG_TABLE.' (param, value) VALUES(\''.$param.'\', \''.$value.'\') ;'; - pwg_query($query); + pwg_query($query); + } + else + { + $query = ' +UPDATE '.CONFIG_TABLE.' + SET value = \''.$value.'\' + WHERE param = \''.$param.'\' +;'; + pwg_query($query); + } } /** |