Ensure that with multiple entries the newest one will be fetched
This commit is contained in:
parent
4404bf1651
commit
4322b56c0b
2 changed files with 4 additions and 4 deletions
|
@ -32,7 +32,7 @@ class Config {
|
||||||
public static function load($family) {
|
public static function load($family) {
|
||||||
global $a;
|
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)) {
|
if(count($r)) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$k = $rr['k'];
|
$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($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PConfig {
|
||||||
*/
|
*/
|
||||||
public static function load($uid,$family) {
|
public static function load($uid,$family) {
|
||||||
global $a;
|
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),
|
dbesc($family),
|
||||||
intval($uid)
|
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),
|
intval($uid),
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
|
|
Loading…
Reference in a new issue