diff --git a/include/Core/Config.php b/include/Core/Config.php index e5515efaf..a93f18814 100644 --- a/include/Core/Config.php +++ b/include/Core/Config.php @@ -32,7 +32,7 @@ class Config { public static function load($family) { global $a; - $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family)); + $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family)); if(count($r)) { foreach($r as $rr) { $k = $rr['k']; @@ -90,7 +90,7 @@ class Config { } } - $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", + $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1", dbesc($family), dbesc($key) ); diff --git a/include/Core/PConfig.php b/include/Core/PConfig.php index 082f1c05c..de8994d1d 100644 --- a/include/Core/PConfig.php +++ b/include/Core/PConfig.php @@ -29,7 +29,7 @@ class PConfig { */ public static function load($uid,$family) { global $a; - $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d", + $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`", dbesc($family), intval($uid) ); @@ -83,7 +83,7 @@ class PConfig { } } - $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1", + $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1", intval($uid), dbesc($family), dbesc($key)