prepare("INSERT OR REPLACE INTO `keyvalue` (`key`, `value`, `channel`, `created`) VALUES (:key, :value, :channel, strftime('%Y-%m-%d %H:%M:%S','now'))"); $stmt->bindValue(":key", $keyname, SQLITE3_TEXT); $stmt->bindValue(":value", $value, SQLITE3_TEXT); $stmt->bindValue(":channel", $channel, SQLITE3_TEXT); $stmt->execute(); self::$kv[$keyname][$channel] = $value; } protected static function load() { $db = new Database(); $stmt = $db::$handle->prepare("SELECT * FROM `keyvalue`"); $result = $stmt->execute(); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $channel = $row["channel"]; if ($channel === null) { $channel = "all"; } self::$kv[$row["key"]][$channel] = $row["value"]; } } }