diff options
author | Erich Eckner <git@eckner.net> | 2022-07-15 21:29:16 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2022-07-15 21:29:16 +0200 |
commit | 8de8c576da92f6943e7ab5339b6286d3162b48d9 (patch) | |
tree | c3a897e964ca8683aa44dfce994eb6d9c4b4be5e /html/db.php | |
parent | 00c2358f7d8844942174199a132dab7804bdc48c (diff) | |
download | colocation-8de8c576da92f6943e7ab5339b6286d3162b48d9.tar.xz |
Tagesendstand
Diffstat (limited to 'html/db.php')
-rw-r--r-- | html/db.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/html/db.php b/html/db.php new file mode 100644 index 0000000..9f80d6b --- /dev/null +++ b/html/db.php @@ -0,0 +1,34 @@ +<?php + +if (isset($db)) + return; + +class MyDB extends SQLite3 { + function __construct() { + parent::__construct('/srv/http/vhosts/eckner.net/colocation.eckner.net/backend/sqlite.db'); + } + function exec($query) { + $result = parent::exec($query); + if (!$result) + die(); + return $result; + } + function query($query) { + $result = parent::query($query); + if (!$result) + die(); + return $result; + } + function prepare($query) { + $result = parent::prepare($query); + if (!$result) + die(); + return $result; + } +} + +$db = new MyDB(); +if(!$db) { + echo $db->lastErrorMsg(); + die(); +} |