aboutsummaryrefslogtreecommitdiff
path: root/include/sqlite.php
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2025-09-23 00:07:35 +0200
committerMathias Magnusson <mathias@magnusson.space>2025-09-23 00:07:35 +0200
commitc70851504652267c95194a98756c6875271cdda7 (patch)
tree2c7cd22ad17567e907d36ccf76d7fcad6073a6e1 /include/sqlite.php
parenta2827963fbf6847166360be635c65dc85d20dd0d (diff)
downloadtraedgaardstomten-c70851504652267c95194a98756c6875271cdda7.tar.gz
Implement reviews
Diffstat (limited to 'include/sqlite.php')
-rw-r--r--include/sqlite.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/sqlite.php b/include/sqlite.php
new file mode 100644
index 0000000..6759e36
--- /dev/null
+++ b/include/sqlite.php
@@ -0,0 +1,19 @@
+<?php
+
+$db = new SQLite3("/data/data.db");
+
+function query($q, ...$values) {
+ global $db;
+
+ $stmt = $db->prepare($q);
+ foreach ($values as $key => $value) {
+ $stmt->bindValue(is_int($key) ? $key + 1 : $key, $value);
+ }
+ return $stmt->execute();
+}
+
+function lastRowId() {
+ global $db;
+
+ return $db->lastInsertRowId();
+}