summaryrefslogtreecommitdiff
path: root/html/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'html/db.php')
-rw-r--r--html/db.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/html/db.php b/html/db.php
index 9889c71..4c4fdc7 100644
--- a/html/db.php
+++ b/html/db.php
@@ -45,6 +45,18 @@ class MyDB extends SQLite3 {
$stm -> close();
return $key_id;
}
+ function get_machine_id($machine) {
+ $stm = $this -> prepare('SELECT machines.id AS machine_id FROM machines WHERE machines.name=:name');
+ $stm -> bindValue('name', $machine);
+ $result = $stm -> execute();
+ $result = $result -> fetchArray();
+ $stm -> close();
+
+ if (! $result)
+ return NULL;
+ else
+ return $result['machine_id'];
+ }
function add_machine($machine) {
$stm = $this -> prepare('SELECT COUNT(1) FROM machines WHERE machines.name=:name');
$stm -> bindValue('name', $machine);