Ensure that with multiple entries the newest one will be fetched
This commit is contained in:
parent
4404bf1651
commit
4322b56c0b
|
@ -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)
|
||||
);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue