aboutsummaryrefslogtreecommitdiff
path: root/include/sqlite.php
blob: 6759e368317fbda291588002393750152450c43e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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();
}