diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-01-31 06:11:00 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-01-31 20:45:40 +0300 |
commit | c0dc531ebefd8912819f3b6c8bda1fed3c7e750c (patch) | |
tree | 2c75aa9df182260aef09faf4befd81a4c2b9c5e2 /lib/stored_config.php | |
parent | 48d688cdf7f9eae1bf11b8a6f0e5b98687c604cb (diff) |
make it simple, but not simpler
Diffstat (limited to 'lib/stored_config.php')
-rw-r--r-- | lib/stored_config.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stored_config.php b/lib/stored_config.php new file mode 100644 index 0000000..2e7dc8a --- /dev/null +++ b/lib/stored_config.php @@ -0,0 +1,14 @@ +<?php + +function scGet(string $key) { + $db = DB(); + $q = $db->query("SELECT value FROM config WHERE name=?", $key); + if (!$db->numRows($q)) + return null; + return $db->result($q); +} + +function scSet($key, $value) { + $db = DB(); + return $db->query("REPLACE INTO config (name, value) VALUES (?, ?)", $key, $value); +} |